p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 (http://p2p.wrox.com/forumdisplay.php?f=154)
-   -   Figure 4-7 on p. 64 (http://p2p.wrox.com/showthread.php?t=27338)

clm3cv March 27th, 2005 02:25 AM

Figure 4-7 on p. 64
Why does this example render differently in IE6 than in Firefox? (The boxes are centered in IE6, left-aligned in Firefox.) I thought that standards mode meant that they would render the same.

richard.york March 27th, 2005 09:19 AM

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

All times are GMT -4. The time now is 02:58 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.