W3C home > Mailing lists > Public > www-style@w3.org > January 2009

Re: Proposal: related-units-base directive

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 14 Jan 2009 14:55:53 -0600
Message-ID: <dd0fbad0901141255t4be7615bs72b674861b31c877@mail.gmail.com>
To: "Josef Schmid" <e9427749@student.tuwien.ac.at>
Cc: www-style@w3.org

On Wed, Jan 14, 2009 at 11:28 AM, Josef Schmid
<e9427749@student.tuwien.ac.at> wrote:
>
> Hi, too all!
>
> This is a proposal to make the 'rem' unit more
> useful.
>
> For this proposal _relative_ units are different
> to _related_ units.
> So 'rem' is a _related_ unit, and 'em' is _relative_.
>
> The whole idea is, that the reference point can be
> change to something different as the root element.
>
> Synopsis:
>  related-units-base: <value>;
>  related-units-base: <value> <value>;
>
> Values:
>  inherit .... the same as for the parent node.
>               This is the default, except
>               for the root element.
>  root ....... the root element
>  default .... browser/user default, honor
>               user style-sheets for root,
>               but not form author.
>  sel(<css selector>) ... the css-selector
>               is the base. Only selectors
>               which address preceding nodes
>               in document order before the context node
>               (selector of the set where the rule is part of)
>               are allowed. Behavior is undefined for others.
>               If the selector match multiple nodes, the first
>               is used.
>               If the selector match the actual node it is
>               ignored, but are valid for descendants if the
>               inherit.
>  this-for-inherits ... Make the actual node the base
>               for descendant node if the inherit.
>               This needs some further clarification,
>               but hopefully the idea is clear.
>
> If the directive have two values, the first value is used,
> but the second is bequeathed.
>
> ----
>
> More values that are maybe interesting:
>   my-parent ... the parent of the node where the directive
>                 is used.
>   parent ...... the parent node, this makes the all inherits
>                 _relative_.
>
> ----
>
> Example:
> div.toolbox { related-units-base: this-for-inherits;
>              /* ^- identical to
>                    related-units-base: inherit this-for-inherits;
>              */
>              font-size: 12pt;
>            }
> ..toolbox h1 { font-size: 1.2em; }
>
> ----
>
> Other ways to reach the intended exists, ala:
>  * 'from' unit expander,
>  * value-link(...),
>  * unit-base for relative units + feature switch,
>
> So if you think like me this is a issue that should be solved,
> but don't like this proposal than ...

I'm unconvinced that this is actually an issue.  The rem unit is
undoubtedly useful - I have run into problems with em-based
measurements in most projects I've done, where I need to manually
compensate for a parent with larger or smaller text than normal.  I'd
actually use *only* the rem unit in many cases, because it more
accurately maps to what I actually want (a unit that maps to the
user's preferred font-size).

However, I have not yet come upon a case in my designs where I've
wanted the em of an arbitrary element in the document.

Are there any reasonable use-cases that would require this sort of power?

~TJ
Received on Wednesday, 14 January 2009 21:03:50 GMT

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