W3C home > Mailing lists > Public > www-style@w3.org > May 2004

Re: CSS: %% / 'calc' length unit

From: fantasai <fantasai.lists@inkedblade.net>
Date: Fri, 07 May 2004 16:57:40 -0400
Message-ID: <409BF844.7000200@inkedblade.net>
To: www-style@w3.org

Boris Zbarsky wrote:
> 
> Clearer example:
> 
> foo, bar { display: block; }
> foo { width: calc(50% - 100px;) }
> bar { width: inherit; }
> root { width: 50%; }
> 
> <root>
>   <foo>
>     <bar />
>   </foo>
> </bar>
> 
> What happens?  Note that style computation happens before reflow, so 
> when deciding the computed style of "foo" you can only use the "50%" 
> value from "root"; you don't know how many pixels or other absolute 
> units it corresponds to.  If "foo" had "width: 50%", "bar" would inherit 
> the value "50%".  Should it inherit the "calc" expression wholesale?  Or 
> what?

Yes, it would have to inherit the calc expression wholesale; there's no
way to add pixels and percentages until you know the conversion between
the two, and that only happens after style calculation, during layout.

~fantasai

-- 
http://fantasai.inkedblade.net/contact
Received on Friday, 7 May 2004 16:58:03 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:29 GMT