HTML <center> tag

Updated: 11/13/2018 by Computer Hope
HTML center tag

When writing in HTML, the <center> tag was used to contain both block-level and inline elements on a web page. Anything contained in the <center> tags would be aligned with the middle of the page. The following sections contain information about this tag, including an example of it in use, and related attributes and browser compatibility.


The <center> tag is deprecated. Going forward, use the CSS "text-align" property to center elements.

Example of <center> code

<center>Notice that this text is in the middle of the page.</center>

Example result

Notice that this text is in the middle of the page.


Within an HTML tag, an attribute dictates certain aspects of an HTML element. Attributes are made up of a name and value pair. While the <center> tag does not have any unique attributes, it utilizes all the standard attributes until it's removed in a future version of HTML.


Edge Internet Explorer Firefox Safari Opera Chrome
All versions* All versions * All versions * All version * All versions * All versions *

*Until it is removed in a future version of HTML

Browser, Compatibility, Container tag, Web design terms