[webkit-dev] Your opinion on a CSS proposal

David Hyatt hyatt at apple.com
Tue Jun 5 22:13:25 PDT 2007


On Jun 5, 2007, at 9:29 PM, Windy Road wrote:

> On 06/06/07, David Hyatt <hyatt at apple.com> wrote:
>> I don't quite understand the proposal.  width can be defined in terms
>> of font-size.... therefore it's impossible to define font-size in
>> terms of width.  For example, width:50em, font-size:auto would be
>> undefined, since each would depend on the other.
>
> Take a block element who's width is auto, generally speaking it's
> width will be determined by the parent, the parent's padding and the
> element's margins.  A block element with a font relative width and a
> font-size of auto would have it's width calculated in the same way as
> the block element with a width of auto.  Once the width is calculated,
> the font-size (in px) is determined by the following formula:
>
>    font-size = calculated_width_in_px / font_relative_width
>

Except that the width of an element can depend on the font size.  If  
you say "width:50em" that means 50ems using *your* calculated font  
size.  In other words, CSS has already created the restriction that  
font-size must be calculated before width can be calculated.

Your idea is interesting, but it can't really be defined using font- 
size.  It's more of an "after-the-fact" adjiustment based off the  
calculated width of a block.

dave




More information about the webkit-dev mailing list