HTML Tags

HTML <center> Tag

The <center> tag was used to horizontally center-align content in HTML.
It is deprecated in HTML5 and should be replaced by CSS styling (text-align: center;) for modern web development.

Syntax

html

<center>Content to be centered</center>

Attributes

AttributeDescription
NoneThe <center> tag does not have any specific attributes.

Example

html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Center Tag Example</title>
</head>
<body>

<h2>Deprecated <center> Tag Example</h2>

<center>
  <p>This paragraph is centered using the deprecated <center> tag.</p>
</center>

<p>Modern alternative: use CSS <code>text-align: center;</code></p>

</body>
</html>

Output

Browser Output

html

The text inside the <center> tag is displayed horizontally centered in the browser.
Please use our TryIt Editor to see the visual effect.

Browser Support

Chrome
Edge
Firefox
Safari
Opera
IE9+
YesYesYesYesYesYes

All major browser support <center> tag

Notes

  • The <center> tag is deprecated and may be removed in future HTML versions.
  • Use CSS text-align: center; for proper, modern web standards.
  • This tag only affects horizontal alignment of inline and block content.

Conclusion

The <center> tag was historically used for horizontal alignment but is obsolete.
Modern web design should always use CSS for centering content.