View Single Post
  #2 (permalink)  
Old March 27th, 2005, 09:19 AM
richard.york's Avatar
richard.york richard.york is offline
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts

In an ideal world everything would render identically in all browsers. Here you are seeing a very old bug in Internet Explorer. Well, most developers consider it a bug, but in reality it is a feature that Microsoft developers decided on long ago. That feature is that using the text-align: center; declaration will center all text and block elements that appear as children in the containing block (in this case the containing block is the <body> element). OK, so big deal that's what's it's supposed to do, right? Wrong. According to the standards only text is supposed to be centered with the text-align property. IE also centers block elements like <div>, <form>, <h1>, etc, eventhough that isn't what the standards say to do (it is after all the text-align property). That's why Firefox, et al don't center the <div> elements in that example. For block elements you'll see how alignment of blocks is controlled in Chapter 10 with the margin property.

But you are correct in your understanding of standards mode, it is supposed to make things render more consistently with other browsers (and it helps loads), but there are still bugs to fight with in IE in standards mode (oh how there are bugs!).


Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design