<center>


HTML <center> Tags - HTML5 Not supported

##Instance

<!DOCTYPE html>
<html>
<body>

<p>This is some text.</p>
<center>This text will be center-aligned.</center>
<p>This is some text.</p>

</body>
</html>

Run instance»Click the "Run instance" button to view the online instance


Browser support

1000.png ##All major browsers support the <center> tag.

Tag definition and usage instructions

HTML5 does not support the <center> tag. Please use CSS instead.

In HTML 4.01, the <center> element is deprecated.

<center> Centers the text it contains horizontally.

Tips and Notes

Tips:

Please use CSS styles to center text! You can learn more details about centered text in the CSS tutorial.

Differences between HTML 4.01 and HTML5

HTML5 does not support the <center> tag, and HTML 4.01 has deprecated the <center> tag.

Standard attributes

In HTML 4.01, the <center> tag supports the following standard attributes:

Attributesclassclassnamedir ltrididlanglanguage_codestylestyle_definitiontitletext

For a complete description, please visit the standard properties.


Event attributes

In HTML 4.01, the <center> tag supports the following event attributes:

ValueDescription
Specifies the class name of the element
rtl
Specifies the text direction of the content in the element
Specifies the uniqueness of the element id
Specifies the language code of the content in the element
Specifies the inline style of the element
Specifies additional information for elements
##AttributesValueDescriptiononclickWhen the mouse is clicked Execute scriptondblclickExecute script when the mouse is double-clickedonmousedownExecute script when mouse button is pressedonmousemoveExecute script when mouse pointer movesonmouseoutExecute the script when the mouse pointer moves out of an elementonmouseoverWhen the mouse pointer hovers over Execute the script when on an elementonmouseupExecute the script when the mouse button is releasedonkeydownExecute script when the keyboard is pressed## onkeypress#scriptonkeyupscriptFor a complete description, please visit the event properties.
script
script
script
script
script
script
script
script
Execute script when the keyboard is pressed and then released
Execute script when the keyboard is released