The <center> element is a block-level container that horizontally centers its contents. It was common in early HTML for titles and banners.
Do not use it in new projects. Prefer CSS: text-align: center for text/inline content, and margin: 0 auto for block boxes with a set width. Keep presentation in CSS and meaning in HTML (<div>, <p>, and so on).
Deprecated / obsolete.
Avoid in new code. Deprecated since HTML 4 in favor of CSS; obsolete in HTML5. Browsers still render it for old pages, but conforming documents must not use it.
Syntax
HTML Syntax
syntax.html
<center>content</center>
Both tags are required when you encounter legacy markup. Nesting more <center> elements is unnecessary — one wrapper centered everything inside. Modern replacement: a normal block + CSS, not this tag.
Reference
Attributes
<center> has no element-specific attributes. Only the global attributes apply (and the element itself is obsolete).
Attribute
Description
Status
None specific
No dedicated centering attributes — the tag itself forced centered layout.
Move centering to CSS with text-align: center on the heading or a parent.
Result: same look, valid HTML, styles reusable across pages.
Edge Cases & Pitfalls
Most mistakes mix “center the text” with “center the box,” or keep shipping obsolete tags.
obsolete
Do not use in new HTML
Even though browsers still draw <center>, HTML5 marks it obsolete. Validators fail, and teams should treat it as legacy-only.
css
text-align ≠ block centering
text-align: center centers inline content inside a box. To center the box itself, use a width plus margin: 0 auto (or modern layout like flex/grid).
semantics
Presentation is not meaning
<center> only means “look centered.” Prefer headings, paragraphs, and sections, then style them.
legacy
Nested <center> stacks
Old pages sometimes nested many centers. One CSS rule on a parent replaces all of that noise.
Compatibility
Browser Support
Browsers still render <center> for old pages, but the element is obsolete in the HTML standard. Prefer CSS everywhere.
✓ Obsolete · Legacy rendering
<center>
Still painted by Chrome, Firefox, Safari, Edge, and Opera for compatibility. Do not use it in new documents — use text-align and margin (or flex/grid) instead.
—Not recommended for new sites
Google ChromeAll
Renders (legacy)
Mozilla FirefoxAll
Renders (legacy)
Apple SafariAll
Renders (legacy)
Microsoft EdgeAll
Renders (legacy)
OperaAll
Renders (legacy)
Samsung InternetAll
Renders (legacy)
Internet ExplorerAll
Renders (legacy)
<center>Legacy support only
Bottom line: Support exists only so old pages keep working. For new work, choose CSS centering — never the center element.
Remember
Key Takeaways
Status:<center> is obsolete — study it, do not ship it.
Text: use text-align: center on a block container.
Boxes: width + margin: 0 auto centers the block itself.
Migrate: keep semantic tags; move layout into CSS classes.
One line: replace <center> with normal HTML plus CSS text-align / margin: auto.
UA style
Default CSS Settings
User agents map the obsolete element roughly to this presentational rule:
default.css
center {
display: block;
text-align: center;
}
That is why a CSS class with the same text-align rule is the direct modern equivalent for centered text.
Frequently Asked Questions
No. The center element is obsolete (deprecated). Do not use it in new pages. Prefer CSS text-align: center for inline content and margin: 0 auto for block boxes with a width.
It was a block-level element that horizontally centered its contents inside the containing block (often the body).
Yes, browsers still render it for backward compatibility, but validators flag it and it is not allowed in conforming HTML documents.
Apply text-align: center to a block container such as a div or p. That centers the text (and inline content) inside the element.
Give the block a width, then use margin-left: auto and margin-right: auto (or margin: 0 auto). text-align alone does not shrink or center the block box itself.
Yes. Replace <center>…</center> with a semantic element (div, p, section, etc.) plus CSS, so layout stays in stylesheets and markup stays meaningful.