HTML Tags

HTML <center> Tag Not Supported in HTML5

Topic: HTML5 Tags ReferencePrev|Next

Description

The <center> element aligns contents in the center of the enclosing block.

The following table summarizes the usages context and the version history of this tag.

Placement: Block
Content: Block, inline, and text
Start/End Tag: Start tag: required, End tag: required
Version: HTML 3.2, 4, 4.01 (transitional)

Warning: Don't use this tag since it is a non-standard tag and has been deprecated in HTML 4.01 and obsolete since HTML5. Use CSS instead, to center content.


Syntax

The basic syntax of the <center> tag is given with:

HTML / XHTML: <center> ... </center>

The example below shows the <center> tag in action.

<!--Example of bad usage. Don't use this tag-->
<center>This paragraph will be centered.</center>
<!--Alternative-->
<p style="text-align: center;">This paragraph will be centered using CSS.</p>

Tip: To give a similar effect to the center tag, use the CSS text-align property, which can be applied to the <div> element or to an individual <p>.


Tag-Specific Attributes

The <center> tag doesn't have any specific attribute.


Browser Compatibility

The <center> tag is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 1+
  • Google Chrome 1+
  • Internet Explorer 2+
  • Apple Safari 1+
  • Opera 4+

Further Reading

See tutorial on: HTML Text Formatting, CSS Alignment.

Bootstrap UI Design Templates Property Marvels - A Leading Real Estate Portal for Premium Properties