467,915 Members | 1,549 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,915 developers. It's quick & easy.

Collapsing margins rule

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
  • viewed: 1397
Share:

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Jukka K. Korpela | last post: by
12 posts views Thread by Secret Guy | last post: by
7 posts views Thread by Kyle James Matthews | last post: by
5 posts views Thread by Borris | last post: by
1 post views Thread by yb | last post: by
1 post views Thread by Jeremy | last post: by
5 posts views Thread by SlowArrow | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.