I’m familiar with this problem, you’re supposed to give padding-top to containing element otherwise FF won’t respect top margin (people say that well, actually FF is correct here, I don’t see how, this is extremely annoying…)
however: what if my element is not at the top of a containing element, but simply follows an other element in the containing div? to which I cannot give a bottom-margin? – it’s a ul – but I can’t give it a bottom-mgn because then it would give all other ul’s above the last ul a bottom-mgn also… so then I would have to give that lastul a bottom-mgn (not very practical for dynamic content…) so then I could wrap all ul’s in a wrapper div and give that wrapper div a bottom margin, and that other thing a margin only for the bottom… ) this for an hr, but I had to chg the hr to a div I styled like an hr b/c IE has problems with hr top & bottom margins…
man… I do get so sick of this cross-browser stuff sometimes; most problems I’m able to solve fine, but every once in a while I come across something really annoying…
so: is there any way I can get FF to respect top-margin here???
thank you everyone for your responses… this is a weird problem… I fixed my issue, I can’t reproduce the problem anymore!!! it’s working fine now (top elem. has mgn-btm of 0, following elem has mgn-top of 20px… and it’s working as expected… )
at any rate, margin-collapse deals with when you have an element with margin-bottom, followed by an element with margin-top; in my case top element had margin 0, and it was still causing the problem… (I had known previously about margin-collapse when you have an element with bottom-mgn followed by an element with top-mgn… in fact I first read about it in a Sitepoint CSS book…
It’s not just adjacent margins, but also a first-child box with a top margin inside a container with no margins… the margin gets transferred to the container, instead of what you expected (space between top of container and top of first-child box).