HTML <center> tag

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

When writing in HTML (hypertext markup language), 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.

Note

The <center> tag is deprecated. From now on, use the CSS (cascading style sheets) "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.

Attributes

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

Compatibility

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