The <center> element was used historically to center content, usually text, within its containing elements. It has since been deprecated and removed from the HTML specification. While some browsers might support it for backwards compatibility, it should no longer be used.

The current practice in HTML is to use the CSS property text-align to center text and to use properties of the CSS box model to center other elements.


<center><!-- text or other element to center goes here --></center>

<center> was typically found as a child of the <body> element to center elements on the page.


Historical use:

<!-- Don't use this! -->
This is centered text.
<p>This is a centered paragraph</p>

The modern alternative is using a <div> element, instead:

<!-- Use this, instead. :) -->
<div style="text-align:center;">
This is centered text.
<p>This is a centered paragraph</p>


Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.

Learn HTML on Codecademy