HTML <center> tag

Updated: 04/26/2017 by Computer Hope

HTML center tagWhen 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, as well as related attributes and browser compatibility.

Note: The <center> tag is deprecated. Going forward, you should the CSS text-align property to center elements.

Example 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.

Attributes

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 will utilize all of the standard attributes until it is removed in a future version of HTML.

Compatibility

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

*Until it is removed in a future version of HTML

Browser, Compatibility