![]() | |
![]() |
| | Thread Tools | Display Modes |
#11
| |||
| |||
|
|
In article <slrnfpjhmg.i9u.spamspam (AT) bowser (DOT) marioworld>, Ben C <spamspam (AT) spam (DOT) eggs> wrote: On 2008-01-25, dorayme <doraymeRidThis (AT) optusnet (DOT) com.au> wrote: In article ed3bc541-eb6d-4bdb-bb36-8b27c4f31bdb...oglegroups.com http://netweaver.com.au/alt/martinPractica13.html The last is particularly interesting as it seems to trigger quite a surprising thing in Opera: the mere mentioning in the css of a zero height for a clearing div is enough for Opera to suddenly think, ah, there is a 10px top border on a different static div That is very strange. If you set height: auto in Opera you get no gap, but height: 0px and you get the gap. There is no justification for that that I can see. Nor can I. This was so in Opera 9.24 for Mac. I have wondered if appears on Windows machines. |
#12
| |||
| |||
|
|
On 2008-01-25, dorayme <doraymeRidThis (AT) optusnet (DOT) com.au> wrote: In article <slrnfpjhmg.i9u.spamspam (AT) bowser (DOT) marioworld>, Ben C <spamspam (AT) spam (DOT) eggs> wrote: On 2008-01-25, dorayme <doraymeRidThis (AT) optusnet (DOT) com.au> wrote: In article ed3bc541-eb6d-4bdb-bb36-8b27c4f31bdb...oglegroups.com http://netweaver.com.au/alt/martinPractica13.html The last is particularly interesting as it seems to trigger quite a surprising thing in Opera: the mere mentioning in the css of a zero height for a clearing div is enough for Opera to suddenly think, ah, there is a 10px top border on a different static div That is very strange. If you set height: auto in Opera you get no gap, but height: 0px and you get the gap. There is no justification for that that I can see. Nor can I. This was so in Opera 9.24 for Mac. I have wondered if appears on Windows machines. I should think that part of the code is common to all platforms. I tried a simpler (or rather different) test. #one, #three { height: 200px; background-color: palegreen } #one { margin-bottom: 10px } #two { height: 0px } #three { margin-top: 10px } div id="one"></div div id="two"></div div id="three"></div One's bottom margin, two's top and bottom margins (both 0) and three's top margin should all collapse together resulting in 10px separating the two green boxes. But Opera leaves a 20px gap. But if you set #two to height: auto, it collapses across #two correctly. I tested this in 9.25 on GNU/Linux. The older version I had (8.50 I think) didn't collapse across the gap even with height: auto. It probably would be quite easy for them to fix. It's a different bug from the one you've found though. Whether or not you see the 10px in martinPractical3.html should not depend on whether margins collapse through the empty div or not. |
#13
| |||
| |||
|
|
In article <slrnfpkobn.q5a.spamspam (AT) bowser (DOT) marioworld>, Ben C <spamspam (AT) spam (DOT) eggs> wrote: [...] I tried a simpler (or rather different) test. #one, #three { height: 200px; background-color: palegreen } #one { margin-bottom: 10px } #two { height: 0px } #three { margin-top: 10px } div id="one"></div div id="two"></div div id="three"></div One's bottom margin, two's top and bottom margins (both 0) and three's top margin should all collapse together resulting in 10px separating the two green boxes. But Opera leaves a 20px gap. But if you set #two to height: auto, it collapses across #two correctly. I tested this in 9.25 on GNU/Linux. The older version I had (8.50 I think) didn't collapse across the gap even with height: auto. It probably would be quite easy for them to fix. It's a different bug from the one you've found though. Whether or not you see the 10px in martinPractical3.html should not depend on whether margins collapse through the empty div or not. I confirm what you found, I have no idea if it is a different bug, how do we count bugs? |
#14
| |||
| |||
|
|
I have two div's that have float:left and a third that has clear:left and margin-top:10px. In IE 6 & 7, it displays as I intended, but in Safari, Firefox, Opera, it "ignores" the margin-top of the third div. If I put a margin-bottom:10px on one of the first two floated divs, I can get the desired effect, but am curious as to why it is not "working" in the non-ie browsers as initially stated? Sample: http://www.ericmmartin.com/code/css/margin-float.html |
#15
| |||
| |||
|
|
On 2008-01-25, dorayme <doraymeRidT... (AT) optusnet (DOT) com.au> wrote: In article ed3bc541-eb6d-4bdb-bb36-8b27c4f31... (AT) 1g2000hsl (DOT) googlegroups.com , Eric Martin <emarti... (AT) gmail (DOT) com> wrote: I have two div's that have float:left and a third that has clear:left and margin-top:10px. In IE 6 & 7, it displays as I intended, but in Safari, Firefox, Opera, it "ignores" the margin-top of the third div. If I put a margin-bottom:10px on one of the first two floated divs, I can get the desired effect, but am curious as to why it is not "working" in the non-ie browsers as initially stated? Sample: http://www.ericmmartin.com/code/css/margin-float.html It is a difficult matter. You can read about collapsing margins if you want at http://www.w3.org/TR/CSS21/box.html#collapsing-margins> but it is not an easy read at all and there are quite some complications. You will see how the essentials appear differently in different browsers: http://netweaver.com.au/alt/martin.html In iCab (surprise?) and Mac IE5 (and I would bet quids on Win IE6 and a good few less quids on IE7) you will have the 10px white space of the body showing. They're wrong But not on FF, Camino, Opera, Safari. They're getting it right. There should be no gap. Clear on a non-floated block moves the block down far enough for its top border to clear the floats above it, not for its top margin to clear them. |
Is that specifically
#16
| |||
| |||
|
|
(You made a remark earlier about some prob OP was having that was unlikely to be about collapsing margins. I suspect you are right now. I just followed John's lead and could not see my way though the collapsing margin spec in its relevance and had meant to study it closer later. But a lot has more to do with how cleared elements are supposed to work. I thought I better mention this in case the OP was misled by me. I think he is a practical fellow anyway and will do something that suits. But I think I would have gone on to look at it in my post in much the same way anyway to search for a practical solution.) -- dorayme |
#17
| |||
| |||
|
|
On Jan 25, 3:23 am, Ben C <spams... (AT) spam (DOT) eggs> wrote: On 2008-01-25, dorayme <doraymeRidT... (AT) optusnet (DOT) com.au> wrote: [...] http://netweaver.com.au/alt/martin.html In iCab (surprise?) and Mac IE5 (and I would bet quids on Win IE6 and a good few less quids on IE7) you will have the 10px white space of the body showing. They're wrong But not on FF, Camino, Opera, Safari. They're getting it right. There should be no gap. Clear on a non-floated block moves the block down far enough for its top border to clear the floats above it, not for its top margin to clear them. Interesting. It seems counter-intuitive to me Is that specificallymentioned in the spec or is it derived from all of the different rules? I was looking at http://www.w3.org/TR/CSS21/visuren.html#propdef-clear but couldn't seem to find it. |
#18
| |||
| |||
|
|
Eric Martin wrote: I have two div's that have float:left and a third that has clear:left and margin-top:10px. In IE 6 & 7, it displays as I intended, but in Safari, Firefox, Opera, it "ignores" the margin-top of the third div. If I put a margin-bottom:10px on one of the first two floated divs, I can get the desired effect, but am curious as to why it is not "working" in the non-ie browsers as initially stated? Sample: http://www.ericmmartin.com/code/css/margin-float.html Firefox appears to not honor the clear:left; in: #three {width:400px; clear:left; background:#aaa; margin-top:10px;} |
|
Remove the clear:left; in the above stylesheet rule and in the markup immediately before <div id="three"> add a clearing div as: div style="clear:left;height:auto; width:auto;"></div or div style="clear:left;height:0; width:0;"></div The margin-top will then be honored by Firefox and by Safari. |
|
Opera does not like the former at all, but honors the latter. |
![]() |
| Thread Tools | |
| Display Modes | |
| |