How To Center Align Your Text Using CSS [HTML Is Deprecated]
Disclosure: Your support helps keep the site running! We earn a referral fee for some of the services we recommend on this page. Learn more
- What does
How To Center Align Your Text Using CSS [HTML Is Deprecated]
do? - The <center> element was used to identify text that should be centered when rendered by a browser. However, the element has been deprecated, and the correct and modern way to center-align text is with CSS.
- Display
- block
- Usage
- textual
Code Example
<center>
<h2>How Not to Center with HTML</h2>
<p>This text may be centered...but you would be better off using CSS to center text or other elements on a web page.</p>
</center>
How Not to Center with HTML
This text may be centered...but you would be better off using CSS to center text or other elements on a web page.