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

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

From: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Date: Mon, 20 Aug 2012 12:05:39 +0200
Message-ID: <CAOxFTcxYi-1QHSTzbxDJkRDM8ZvWWFaWR_=6u4CpEUan98=Jkw@mail.gmail.com>
To: Simon Sapin <simon.sapin@kozea.fr>
Cc: www-style@w3.org
On Mon, Aug 20, 2012 at 11:39 AM, Simon Sapin <simon.sapin@kozea.fr> wrote:
> Le 20/08/2012 11:32, Giuseppe Bilotta a écrit :
>
>> So, if I understand your suggestion correctly, I can set the font size
>> of the html element explicitly, provided that I then use fixed widths
>> in the media queries, manually computed from the fixed font size that
>> I select (e.g. if I set a font size of 12pt, then I should replace a
>> media query for 66em with a media query for 1056px, and the media
>> query will trigger correctly regardless of the actual font family that
>> gets selected.
>
> Yes, this is what I was suggesting.
>
> A small note: you can use font-size: 16px instead of 12pt, they’re always
> the same in CSS. It makes one less conversion to deal with.
>
> http://dev.w3.org/csswg/css3-values/#lengths

I just tried the approach you suggested, using 14px (which is what
Opera uses by default on my machine, as opposed to the 16px in Firefox
and Chromium). It works fine. It does have the underside, however,
that if I decide to change the font size of the root element, I have
to redo all the computations, at least until calc() gains large enough
adoption (for example, at the moment even the latest Opera version
doesn't seem to support it yet) to justify its use. I think that for
the time being I will just refrain fro setting a font-size explicitly,
and stick to ems in the media queries. (Of course, all this would not
be an issue if CSS had a way to specify that a container should wrap
its content 'tightly'.)

Thanks a lot again for the clarifications and for the suggestions.

-- 
Giuseppe "Oblomov" Bilotta
Received on Monday, 20 August 2012 10:06:26 GMT

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