Wednesday, November 12, 2008

How to make the content in a DIV center aligned?

Use "margin-left:auto" and "margin-right:auto" for horizontal centering.

It is said online (in one of Jennifer Sullivan Cassidy's articles) that it is not recommended to use "text-align: center;" for horizontal centering for some reason.

vertical-align is for table only and vertical aligning a div is not a trivial thing.

Here is a good way to vertically align a div:
http://phrogz.net/CSS/vertical-align/index.html

No comments: