[thelist] CSS top-margin quirk?

Brooking, John John.Brooking at sappi.com
Sat May 6 14:56:53 CDT 2006

Hey, all,

   I've just encountered a CSS quirk (as far as I can tell) that I don't recall seeing before, although it's such a basic thing that I have to believe that some of you out there know about it, and there may even be a name for it. This is happening in Firefox ( as well as IE 6.
   What I'm seeing is if a paragraph is the very first content in a DIV, and the DIV has a background color or image, the top margin of the paragraph does not allow the DIV's background to shine through. Instead, the BODY tag's background seems to be taken on. This only happens for the top margin of the first paragraph in a DIV, not the rest, and only if no other content is between the start of the DIV and the paragraph. For an example, see http://www.moonpiepress.com/test1.html.
   I have found two workarounds. If I add a border to the DIV, then its background DOES shine through the paragraph's top margin. I can also add a   before the paragraph, so that the paragraph is not the first content. Neither of these is completely satisfactory, because the design may not allow them in all situations.
   This doesn't seem like normal CSS behaviour, is it? If not, does the issue have a name and a commonly-accepted workaround? I've tried a couple of different Google searches but haven't found it referenced. Thanks for any advice!
- John

This message may contain information which is private, privileged or confidential and is intended solely for the use of the individual or entity named in the message. If you are not the intended recipient of this message, please notify the sender thereof and destroy / delete the message. Neither the sender nor Sappi Limited (including its subsidiaries and associated companies) shall incur any liability resulting directly or indirectly from accessing any of the attached files which may contain a virus or the like.

More information about the thelist mailing list