- From: Anton Prowse <prowse@moonhenge.net>
- Date: Thu, 23 Apr 2009 14:56:42 +0200
- CC: www-style@w3.org
Tab Atkins Jr. wrote: > On Wed, Apr 22, 2009 at 5:27 AM, Niels Matthijs > <niels.matthijs@internetarchitects.be> wrote: >> Hi all, >> >> I was reading up on collapsing margins as they've been causing me quite some trouble. Whenever a child element has a different background styling from its parent, collapsing margins are usually troublesome. The collapse is broken by padding and borders, but not by different style of background (which also indicates separation). >> >> Rather than change the rules for collapsing, I wonder if it wouldn't be better to give css people the opportunity to manage them themselves if needed. In short, introduce a new property which can break the collapse when needed, because adding unneeded borders, paddings or overflows is really not the way to go. >> >> Further explanations of my view can be found in the following article: >> http://www.onderhond.com/blog/work/collapsing-margins-improvement >> >> I apologize if this issue was already raised, but couldn't find any information about it. > > I know that a property to indicate that an element should form a block > formatting context has been suggested before. That would prevent > margins from collapsing, as well as doing a few other things. Would > that be acceptable? I feel that this lies at the heart of the issue. In the majority of cases in which I've wanted to suppress margin collapsing, I've actually wanted a BFC (either explicitly, or thinking about it in hindsight). The litmus test for this is to ask whether the block we're trying to suppress margin collapsing for should also act as the scope for 'float' and 'clear'. We really need some concrete real-world examples and detailed use-cases in order to assess the best way forward. Trouble is, although I've needed to suppress margin collapsing lots of times, I struggle to remember now the exact reason and so I can't propose any use-cases off the top of my head. I would guess many others are in the same boat; this issue tends to be very situation-specific. Cheers, Anton Prowse http://dev.moonhenge.net
Received on Thursday, 23 April 2009 12:57:57 UTC