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

Re: margins, ems and context

From: Felix Miata <mrmazda@earthlink.net>
Date: Tue, 25 Jan 2011 12:24:40 -0500
Message-ID: <4D3F0758.9030103@earthlink.net>
To: www-style@w3.org
On 2011/01/25 15:51 (GMT+0100) Niels Matthijs composed:

> 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

I tried to leave a comment there, but couldn't figure out how to get it past 
the preview stage. Here is what I tried to submit:

Seems a deviation from the em sizing plan makes sense for margins. Margins 
usually are small values, usually leading to bothersome rounding issues. Why 
not use px for small values instead?

The other deviation option, not fully supported yet, but in CSS3, and so 
available long before any change in box model could take place, is the rem unit.
"How much better to get wisdom than gold, to choose
understanding rather than silver." Proverbs 16:16 NKJV

  Team OS/2 ** Reg. Linux User #211409

Felix Miata  ***  http://fm.no-ip.com/
Received on Tuesday, 25 January 2011 17:28:33 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:42 UTC