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

RE: Control over collapsing margins

From: Niels Matthijs <niels.matthijs@internetarchitects.be>
Date: Tue, 28 Apr 2009 14:09:00 +0100
Message-ID: <EAD6F36F8B8A124FB32D722A828211FD0881AE37@win-s-manc3.shared.ifeltd.com>
To: "Anton Prowse" <prowse@moonhenge.net>, <www-style@w3.org>
Cc: <www-style@w3.org>

-----Original Message-----
From: www-style-request@w3.org [mailto:www-style-request@w3.org] On
Behalf Of Anton Prowse
Sent: 23 April 2009 14:57
To: www-style@w3.org
Cc: www-style@w3.org
Subject: Re: Control over collapsing margins

> 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

The real world examples are quite simple. Whenever you have a visual box
only separated by background color (fe, body bg is black, box bg is
#666) the intended results fails when elements within the visual box are
positioned using margins.

body {background:#000;}
body .box {background:#666; margin:1em;}
body .box>* {margin:1em;}

html example here:
http://users.telenet.be/onderhond/collapsing_margins.html

This is probably a problem I run into every project. It is of course
highly dependent on your way of coding, but like I said earlier, margins
are really the way to go if you want to achieve flexible css code.

I know this problem isn't all that flashy or cool as SVG graphics or any
other nifty css 3 feature, but it seems that we would actually benefit
from a more solid base than excessive css 3 features while we can't even
control our margins.

Greets,
Niels Matthijs
Received on Tuesday, 28 April 2009 13:15:36 GMT

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