By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,648 Members | 1,199 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,648 IT Pros & Developers. It's quick & easy.

Collapsing margins rule

P: n/a
I've been caught out by what I thought was an Opera 7.5p1 issue:
http://www.spartanicus.utvinternet.i...mage_issue.htm

but as was pointed out to me this is actually a fault in my code which
is exposed by the improved CSS standards support in v7.5p1.

The top margin on the <h1> collapses with the zero margin on the <body>
element to form a single margin equal to the margin specified on the
<h1>.

I predict that this improved behaviour will catch out more people as the
collapsing vertical margin rule is probably not sufficiently understood
by quite a few of us. I've encountered this issue before, but Opera 7.5
is the first browser to implement the collapsing vertical margin rule
correctly with respect to the <body> element.

A good understanding of the box model is helpful in solving potential
problems. In the example given above the problem can be solved by
specifying a 1px padding on the <body> element, the rule for collapsing
margins then no longer applies since the padding exists between the
margin on the <body> element and the top margin on the <h1>.

Btw, Opera 7.5p1 is the first browser to display 2 of my older sites
(coded strictly to the standards with no regard for browser quirks)
without any issues, quite a feat.

--
Spartanicus
Jul 20 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.