W3C home > Mailing lists > Public > www-style@w3.org > August 2012

Re: [media-queries] chicken-egg problem with font-based lengths

From: Simon Sapin <simon.sapin@kozea.fr>
Date: Mon, 20 Aug 2012 10:26:54 +0200
Message-ID: <5031F4CE.1030100@kozea.fr>
To: www-style@w3.org
Le 20/08/2012 04:00, Giuseppe Bilotta a écrit :
> While this surely greatly simplifies the implementation, it does
> become bothersome in my case, because it means I cannot_reliably_
> size the #content container when selecting a font different from the
> user's default one. I guess I'll have to think about some different
> approach to achieve a wrapping container.

When you use the em unit (eg. for the width of a box) there are two 

1. All ancestors with a value for font-family use relative units (em, 
ex, %). The value of 1em is ultimately based on the user’s configured 
default, most commonly 16px.
2. At least one ancestors sets a font-family with an absolute unit (px, 
...). 1em has a known absolute value.

It’s easiest to make your stylesheet use 1 or 2 consistently across the 
whole document. With 1 you can use em in media queries and get 
consistent results. With 2, use px or another absolute unit in media 
queries, and you should also get consistent results.

Simon Sapin
Received on Monday, 20 August 2012 08:27:24 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:03 UTC