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

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 20 Aug 2012 08:11:16 -0700
Message-ID: <CAAWBYDAcceDjPA=8g4EwTt5BvoSUyfPufA2dJ+2+_h-JsiPoUw@mail.gmail.com>
To: Felix Miata <mrmazda@earthlink.net>
Cc: www-style@w3.org
On Mon, Aug 20, 2012 at 8:04 AM, Felix Miata <mrmazda@earthlink.net> wrote:
> On 2012/08/20 11:39 (GMT+0200) Simon Sapin composed:
>> A small note: you can use font-size: 16px instead of 12pt, they’re
>> always the same in CSS.
>
> That statement is misleading. Most modern browsers at default settings will
> render them the same, but most older ones will not, and Konqueror still
> holds true to making a pt display density dependent. This means if the DE is
> configured to accurately match display device density, a pt will in fact
> measure 1/72" at the device surface, regardless how many px it takes to
> render it. This is generally no longer possible in modern browsers. The
> other exception is the Geckos, which provide the mozmm unit. If you wish a
> 12pt font from a Gecko, you get it by specifying font-size: 4.2333mozmm
> instead of or following font-size: 12pt or 16px.

No, it's accurate.  The pt unit is defined as 4/3 of the px unit,
which is defined as 1/96 of the in unit, regardless of user defaults
or anything else.  All modern browsers implement this, because it's
required for web compatibility.  Old or minority browsers may have
different behavior, but that's always true.

It appears that you are, in general, confused about what the px unit
represents - it is *not* the same size as a device pixel, in general.
Instead, it's defined in terms of visual angles, so that 1px will look
like approximately the same length on any device.  Desktop browsers
generally size the px unit to be an integer multiple of device pixels,
but zooming can change that, and there are a lot of mobile devices
that default to a non-integer ratio.

~TJ
Received on Monday, 20 August 2012 15:12:08 GMT

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