W3C home > Mailing lists > Public > www-style@w3.org > January 2011

margins, ems and context

From: Niels Matthijs <niels.matthijs@internetarchitects.be>
Date: Tue, 25 Jan 2011 15:51:41 +0100
Message-ID: <4D3EE37D.4020409@internetarchitects.be>
To: www-style@w3.org
Just wondering,

currently the box-model states that margins are integral part of the 
box. This means that when you change the font-size of a css box, margins 
defined in ems will change too. This is more often than not (never ran 
into a situation where I was actually happy with it, but who knows ...) 
unwanted behavior. You usually want margins of a box to match themselves 
to the font-size of its parent box (creating a clean vertical grid).

One difficulty has been pointed out by a commenter on my blog, who 
states that the setup changes when a box is absolutely positioned, 
though in that case it sounds quite reasonable to match em-margins to 
the font-size of it's reference block (the pos:abs/pos:rel block closest 

I know it's not feasible to just change the way the css box model works, 
one option would be to introduce a new css property (much like 
box-sizing, could be box-calculate?).

For a more detailed description of the problem, the cause and solution 
you can check:

Niels Matthijs
Received on Tuesday, 25 January 2011 14:50:22 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:07:55 UTC