Centering Content

<DIV ALIGN="CENTER"> is dead. So is the use of tables to position non-tabular content. Unfortunately, current browsers don't always correctly implement the new CSS techniques for centering, and even when they do it's not readily obvious how to do it (at least, it wasn't for me). This page shows how to accomplish centering.

How It Works

To center text content, apply the "text-align: center;" CSS attribute. For block elements, apply the "margin-left: auto; margin-right: auto;" attributes, as follows:

Works for me.

Whee!Yippee!

If the table above is not centered, you may be viewing this page in Internet Explorer, which has some problems with "margin-left: auto; margin-right: auto;". In this case, the table needs to be wrapped in a block with style "text-align: center;".

Whee!Yippee!