Re: [css-units] Proposal for next level: Responsive Pixel

31.08.2012, 14:32, "François REMY" <fremycompany_pub@yahoo.fr>:
> Hi everyone,
>
> Recently, I had to hand-edit a ‘responsive’ stylesheet containing a lot of rules like this one (from Wordpress’s TwentyTwelve (2012) theme) :
>
>     .page-template-homepage-php #secondary aside li {
>         margin: 8px 0 0;
>         margin: 0.571428571rem 0 0;
>         font-size: 13px;
>         font-size: 0.928571429rem;
>         line-height: 1.714285714;
>         list-style-type: square;
>         list-style-position: inside;
>     }
>
> The goal of the duplicate ‘rem’ instructions is pretty clear to me: if an user decides to increase the default font-size of its browser, the template as a whole will be made bigger (zoom effect). Combined with ‘(max-width: XXrem)’ media queries, you can obtain a theme fully adapted to vision impaired users in rem-enabled browsers (IE9, others).
>
> However, hand-editing such stylesheets is a pain (you’ve to keep your console open and perform rules-of-three computations when you modify a value in pixels to change the value in rem accordingly). I’m therefore propositing to add ‘rpx’ aka the ‘Responsive Pixel Unit’ to later revisions of CSS Values and Units. It’s value is computed as follow: (1rem) / (the default font size settings of the browser) * (1px)..
>
> What do you think of this idea?

Actually, you can just specify base font-size for `HTML` element instead of `BODY` element. For example:

    HTML {font-size: 13px; }
    /* `rem` is now equal to 13 pixels */

What would be more important is ability to specify font-size based on font-size of exact _parent_ or _ancestor_ instead of root element. I've proposed this back in 2012-04-01:

http://lists.w3.org/Archives/Public/www-style/2012Apr/0010.html

Received on Friday, 31 August 2012 13:02:05 UTC