- From: Michael Jansson <mjan@em2-solutions.com>
- Date: Tue, 14 Apr 2009 16:22:42 +0200
- To: www-style@w3.org
- Message-ID: <49E49C32.50305@em2-solutions.com>
I believe I have read comments about this but I can't find any references after going through the CSS 2.1 spec. Would appreciate any insight into this question. If you remember an old mail-thread, then just point me in the right direction (I must be searching with the wrong keywords since I'm not finding anything on this topic). If I look at this code in a modern browser... <!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01//EN'> <html> <body style='border:1px solid red; background-color:#fee; margin:10px; padding:0px'> Some text </body> </html> ...I'm getting a page with colored margin. I believe the spec is pretty clear that margins are transparent, thus letter the background of the containing block to show though. However, I think I have read somewhere that there is an exception for the body/root element. It's background property would not only be applied to the content and padding region like it would for other elements, but it would also cover its margins. Is this correct? Are there other exceptions like this? (Don't think the spec is very clear). Anyhow, this is what I believe I have read somewhere, but I can find any references to this. If this is not the case, then what is it that I am missing here? Why is the margin region pink with the code above? A second question would be why there is such a difference between the result in browsers when the DTD is removed from the code above? The margin is collapsed in IE, the height is expanded in both IE and Safari, and FireFox and Opera remains unchanged. Thanks, Em2 Solutions AB Michael Jansson
Received on Tuesday, 14 April 2009 14:23:49 UTC