- From: Bruno Fassino <fassino@gmail.com>
- Date: Sun, 24 Jan 2010 14:11:58 +0100
- To: Anton Prowse <prowse@moonhenge.net>
- Cc: www-style <www-style@w3.org>
On Sun, Jan 24, 2010 at 1:41 PM, Anton Prowse <prowse@moonhenge.net> wrote: > >> The clearance computation include point 2 which says: >> >> "the distance to which _these margins_ collapsed when the hypothetical >> position was calculated" > > It is not at all clear to me what "these margins" refers to. > >> >> (As a side note, that whole point 2 seems currently ignored by all >> browsers. Mozilla has the related bug 376365, don't know the others. >> Does this situation mean that the spec are possibly going to change >> here?) > > As it stands, point 2 is completely incomprehensible to me, and I have > no idea how to test whether or not it has been implemented. As I said > in that previous post, point 1 contemplates "the amount necessary to > place the border edge of the block even with the bottom outer edge of > the lowest float that is to be cleared", and I can't construct a > situation in which this is *not* the desired clearance. Point 2 should have an effect in a case like this <div>Above</div> <div style="background:lime"> <div style="float:left; width:20px; height: 20px; background:blue"></div> <div style="clear: left; margin-top: 30px; height:10px; background:red"></div> </div> In absence of clear the 30px top margin goes outside the lime parent, pushing it down with the included float. Clearance is needed, it stops that collapsing so that the lime parent and the float move up. If the element with clear is positioned just below the float it ends up in a higher position than without the clear, with a negative clearance of -10px. I think point 2 should guarantee that this does not happen. Indeed it requires that clearance x satisfy: 0 (collapsing above clearance) + x + 30 (collapsing below clearance) >= 30 (collapsed value in 'hypothetical' computation) This implies that x >= 0, so in this case the clearance should not become negative, it should stay at 0, and the top border edge of the element with clear should end up 10px below the float bottom edge (in the same position it was without the clear property). The above is essentially the same as this David Barons's test case http://dbaron.org/css/test/2007/0329-blog-examples/1 Of course things may become more complex when adding other margins. >> This is what >> happens in that browsers when there is clearance (even if the spec >> reflects this only in the margin collapsing part, not in the height >> definition, as has been noticed by David Baron >> http://lists.w3.org/Archives/Public/www-style/2007Mar/0105.html). > > [As for the height thing which David raised (ensuring that clear on an > empty block at the end of its parent expands the height of that parent), > this has already been addressed, right? > Compare the last sentence of the penultimate paragraph of > http://www.w3.org/TR/2006/WD-CSS21-20061106/visudet.html#normal-block > with > http://www.w3.org/TR/2009/CR-CSS2-20090908/visudet.html#normal-block .] Ah, many thanks, I didn't notice that change! Best regards, Bruno -- Bruno Fassino http://www.brunildo.org/test
Received on Sunday, 24 January 2010 13:12:31 UTC