Generic block container. Use with CSS text-align or flexbox/grid for centering. Learn more → Paragraph element. Apply text-align: center via CSS class for centered paragraphs. Learn more → The HTML 3.2 (1997): First standardized appearance. The element was created to match existing browser implementations. HTML 4.01 (1999): Deprecated in favor of CSS text-align property. W3C recommended avoiding it in new documents. XHTML 1.0 (2000): Marked as deprecated. Strict XHTML prohibited its use entirely. HTML5 (2014): Completely obsoleted and removed from the specification. Listed in the “obsolete features” section for reference only. Current Standard: WHATWG HTML Living Standard lists Further Reading: MDN Web Docs: Deprecated and Obsolete FeaturesSpecifications
Section titled “Specifications”<center> element appeared in the following specifications:<center> as a non-conforming feature. The specification states it must be treated as a <div> element with text-align: center in the user agent stylesheet.
<center> - Centered Text (Deprecated)
The <center> Element
Section titled “The <center> Element”The <center> element was a block-level element that horizontally centered all of its inline and block-level content. It was introduced in HTML 3.2 (1997) and deprecated in HTML 4.01 (1999), then completely obsoleted in HTML5 (2014).
Historical Example
Section titled “Historical Example”This is how the <center> element was used in older websites:
While this still works in modern browsers, it mixes presentation with structure, which violates modern web development principles.
Why It’s Deprecated
Section titled “Why It’s Deprecated”The <center> element was deprecated for several important reasons:
Separation of Concerns: HTML should describe the structure and meaning of content, while CSS handles presentation and styling. The <center> element violates this principle by embedding visual presentation directly into the markup.
Maintainability: With CSS, you can change the alignment of multiple elements across your entire site by modifying a single stylesheet. With <center>, you must edit each HTML file individually.
Flexibility: CSS provides far more centering options than <center> ever did, including vertical centering, responsive centering, and centering within flex or grid containers.
Semantics: The <center> element conveys no semantic meaning about the content. Modern HTML emphasizes semantic elements that describe what content is, not how it looks.
Accessibility: CSS-based centering works better with assistive technologies and responsive designs, adapting to different screen sizes and user preferences.
Modern Alternatives
Section titled “Modern Alternatives”Text Alignment with CSS
Section titled “Text Alignment with CSS”For centering inline content (text, images, inline elements) within a block container:
The text-align: center property centers inline content within its container. This is the direct replacement for most <center> use cases.
Block Centering with Auto Margins
Section titled “Block Centering with Auto Margins”For centering block-level elements horizontally:
The margin: 0 auto technique centers block elements by setting left and right margins to auto. The element must have a defined width or max-width.
Flexbox Centering
Section titled “Flexbox Centering”For centering content both horizontally and vertically:
Flexbox provides powerful centering capabilities. justify-content: center centers horizontally, while align-items: center centers vertically.
Grid Centering
Section titled “Grid Centering”For centering with CSS Grid:
The place-items: center property is shorthand for centering both horizontally and vertically in a grid container. It’s the most concise centering method available.
Migration Guide
Section titled “Migration Guide”Here’s how to convert old <center> markup to modern CSS:
<!-- Don't use this --><center> <h1>Page Title</h1> <p>Some centered text.</p> <img src="logo.png" alt="Logo"></center>
<center> <div style="width: 600px;"> Centered content block </div></center><!-- For centering inline content --><div class="text-center"> <h1>Page Title</h1> <p>Some centered text.</p> <img src="logo.png" alt="Logo"></div>
<!-- For centering block elements --><div class="centered-block"> Centered content block</div>
<style>.text-center { text-align: center;}
.centered-block { max-width: 600px; margin: 0 auto;}</style>Quick Replacement Rules
Section titled “Quick Replacement Rules”Simple text and inline elements: Replace <center> with a <div> and text-align: center.
Block elements with width: Replace <center> with margin: 0 auto on the block element itself.
Complex layouts: Consider using flexbox or grid for more sophisticated centering that also handles vertical alignment and responsive behavior.
Multiple centered sections: Create a reusable CSS class rather than repeating inline styles or multiple <center> tags.
Historical Browser Support
Section titled “Historical Browser Support”The <center> element was widely supported during its active lifetime:
| Browser | Support Period | Current Status |
|---|---|---|
| Netscape | 2.0 - 9.0 | Legacy support only |
| Internet Explorer | 3.0 - 11.0 | Legacy support only |
| Chrome | All versions | Legacy support only |
| Firefox | All versions | Legacy support only |
| Safari | All versions | Legacy support only |
| Edge | All versions | Legacy support only |
Modern browsers maintain backward compatibility with <center> but mark it as obsolete. It does not validate in HTML5 documents and should not be used in any new development.