HTML center Tag

HTML <center> Tag: The HTML<center> tag aligns the text at center. The HTML center tag is supported in HTML 4.01 but it is not supported in HTML 5. CSS property is used to set the align of element instead of center tag in HTML5.

HTML <center> Tag

Anything contained in the <center> tags would be aligned with the middle of the page.

Syntax: <center> Text </center>



Browser compatibility

The HTML<center> tag is supported by different browsers.

  • Chrome
  • Firefox
  • Opera
  • Safari
  • Internet explorer.

Example:

<!DOCTYPE html>
<html>
<body>
<p>This text is aligned left.</p>
<center>This text is center-aligned.</center>
</body>
</html>

Output:

HTML center tag