1. Computing

Discuss in my forum

How the CSS text-align Property Works

By , About.com Guide

One of the trickier style properties is the text-align property. At first glance it seems pretty straightforward - it aligns the contained text to the right, left, or center. Many people use it exactly as they used the deprecated center tag in HTML.

But this property doesn't work in exactly the same way. The center tag worked by centering everything that was enclosed within it, both content and block-level elements. The text-align property is used to center the contents of a block-level element. Modern browsers such as Netscape 6, Safari 1, Mozilla 1 and IE 6 understand this distinction, but older browsers, including IE 5.5 do not.

The bottom line is that you should not try to use the text-align property to center block elements like div - as you'll only get frustrated.

©2013 About.com. All rights reserved.