Centering Elements on a Page

The center tag is one of those elements that has been deprecated but not forgotten. When centering with CSS seems like too much of a hassle, many continue to use the center tag. It remains well supported and can be used with virtually any element on your page.

To center elements on a page:

1.
Type <center>.
2.
Create the element that you wish to center.
3.
Type </center>.
Figure 4.22. The center element acts like a div element with the align attribute set to center.

✓ Tips

  • The center element is nothing more than an abbreviation of <div align="center"> ... </div>.

    Figure 4.23. The center element continues to be ...

Get HTML, XHTML, & CSS, Sixth Edition: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.