HTML - <center> Tag



The HTML <center> tag is used for centering the content enclosed with this tag.

The <center> tag is deprecated so, if we need to achieve the same reuslt we can use the CSS property text-align:center.

Example

Let's look at the following eample, where we are going to use the center tag.

<!DOCTYPE html>
<html>
<head>
   <title>HTML center Tag</title>
</head>
<body>
   <center>This text is centered</center>
</body>
</html>

When we run the above code, the output window will pop up, displaying the text at the center of the webpage.

Global Attributes

This tag supports all the global attributes described in HTML Attribute Reference

Event Attributes

This tag supports all the event attributes described in HTML Events Reference

html_deprecated_tags.htm
Advertisements