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 
above).

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:
http://www.onderhond.com/blog/onderhond/box-model-margins-problems

Greets,
Niels Matthijs
Onderhond.com
Received on Tuesday, 25 January 2011 14:50:22 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:36 GMT