W3C home > Mailing lists > Public > www-style@w3.org > April 2009

Re: Control over collapsing margins

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 22 Apr 2009 09:55:20 -0500
Message-ID: <dd0fbad0904220755v6325d853s38f971319cd4cb60@mail.gmail.com>
To: Niels Matthijs <niels.matthijs@internetarchitects.be>
Cc: www-style@w3.org
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 agree that the ability to stop margin collapsing at will would be
occasionally useful.  I've had to hack around the problem with 1px
padding or border before as well.

~TJ
Received on Wednesday, 22 April 2009 14:56:00 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 22 May 2012 03:46:58 GMT