On this page
<center>
Prev: `<div>` | Up: text | Next: `<font>`
Rel: CSS display, text, Text & Lists Guide
Ref: MDN Web Docs — <center>
Tags: #public #web #html #elements #text #tier/legacy
Summary
Obsolete presentational element for horizontal centering.
Legacy / Avoid: Prefer CSS display in all new markup.
- Implicit ARIA Role:
generic - DOM Interface:
HTMLElement - Key Attributes:
—
Notes & Best Practices
- Obsolete & deprecated: Use CSS (
text-align: centerfor inline text,margin-inline: autoor Flexbox/Grid for blocks).
Example
<!-- Replace <center> with CSS -->
<div style="text-align: center;">Centered text</div>
Linked from
Related notes
- tuts/html/elements/text/div Linked here; links to this page; shared tags: #elements, #html, #text, #tier, #web
- tuts/html/elements/text/font Linked here; links to this page; shared tags: #elements, #html, #text, #tier, #web
- tuts/html/elements/text Linked here; links to this page; shared tags: #elements, #html, #text, #web
- tuts/html/elements/text_and_lists Linked here; shared tags: #elements, #html, #web
- tuts/css/properties/layout/display Linked here; shared tags: #tier, #web
- tuts/html/elements/text/a shared tags: #elements, #html, #text, #tier, #web
- tuts/html/elements/text/code shared tags: #elements, #html, #text, #tier, #web
- tuts/html/elements/text/dl shared tags: #elements, #html, #text, #tier, #web
- tuts/html/elements/text/h1 shared tags: #elements, #html, #text, #tier, #web
- tuts/html/elements/text/ol shared tags: #elements, #html, #text, #tier, #web