Web Design / HTML

  1. Home
  2. Computing & Technology
  3. Web Design / HTML

How the CSS text-align Property Works

By Jennifer Kyrnin, About.com

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.

Explore Web Design / HTML

About.com Special Features

Build Your Own Website

Step-by-step advice on how to do everything from choosing a Web host to promoting your content. More >

Connect Your Home Computers

Easy ways to connect two computers for networking purposes. More >

Web Design / HTML

  1. Home
  2. Computing & Technology
  3. Web Design / HTML

©2009 About.com, a part of The New York Times Company.

All rights reserved.