W3C home > Mailing lists > Public > www-style@w3.org > February 2003

Re: Length unit relative to media width

From: Bert Bos <bert@w3.org>
Date: Wed, 19 Feb 2003 20:07:20 +0100
Message-ID: <15955.54760.235112.568122@lanalana.inria.fr>
To: "GS" <junkmail.gs@c2i.net>
Cc: <www-style@w3.org>

GS writes:
> Hi, I am new to this list. I don't know if any proposal similar to this has been discussed before. I have a proposal on a new length unit for use in CSS.
> The unit should be relative to the screen (or paper) width.
> The unit should be referenced to the preferred screen resolution.
> I suggest those units:
>    sw8      = (screen.width  /    800 ) px;
>    sw12    = (screen.width  /  1200 ) px;
>    sw16    = (screen.width  /  1600 ) px;
>    sw24    = (screen.width  /  2400 ) px;
> example:
> H2 {   font-size: 36 sw12;  }
> This should give font size 36 pixes in screen  resolution 1200x800. 
> When displayed on a 800x600 screen resolution, the same font will be rescaled to 24 px. 
> On a 1024 x 768 screen resolution, this font-size would be 31px  (rounded upward)

I'm not sure this is very useful. E.g., I have two screens, a small
one and a big, wide one, but the pixels are actually the same size and
the only difference is that on the big screen I can have more windows
(two browser windows next to each other on the small screen, three on
the big one, with room left for other things). But since the windows
are the same number of pixels, nothing inside the windows should be

There is a related proposal that we plan to propose in the next CSS3
Values & Units module: the 'rem' unit will refer to the font size at
the root element. If users set the root font size to their preferred
size (probably with the help of the dialog box that most browsers
already have), then designers can express everything relative to that,
even inside an element that itself has a different font size.

There is then no need to guess a font size based on the size of the
screen (which, as I said, I believe is unreliable). Instead, you can
use the size that the user himself has chosen.

There is something else that is related, that can also replace your
proposal in some circumstances, and that is the Media Queries[1].
There are media features called 'width' and 'device-width' and if you
attach those to a style sheet (see the spec for how to do it), that
style sheet will only be applied if the window, resp. the screen has
that width.

And there is yet another W3C technology in development, that can help
with more complex cases of content-adaptation, called CC/PP[2]: it
allows a client to tell the server what its capabilites/preferences
are so that the server can adapt the content of the document before it
sends it. CC/PP is primarily used by mobile devices, which typically
have limited capabilities and which therefore need content-adaptation
the most.

[1] http://www.w3.org/TR/css3-mediaqueries
[2] http://www.w3.org/Mobile/CCPP

  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos/                              W3C/INRIA
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
Received on Wednesday, 19 February 2003 14:07:22 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:06 UTC