Re: CSS: %% length unit. Proposal.

Anne van Kesteren (fora) wrote:
>> 1) Nonlinearity. Extremely bad for layout calculations. E.g. what will
>> happen if 50% - 100px become negative? Alghoritms will become unstable.
> 
> The same as will happen with 'width:-100px', obviously. I believe that 
> becomes 'width:auto', not entirely sure though.

It becomes 0.  More interestingly:

foo, bar { display: block; }
foo { width: calc(50% - 100px;) }
bar { width: inherit; }

<foo>
   <bar />
</foo>

What does bar inherit?

> Why is the complex? A browser already have to calculate every unit into 
> 'px', since that is the where screens are based upon.

Yes, but _when_ the calculation happens is key.  Also, conversion to px is lossy 
in many cases, leading to rounding issues.

I'm not sure what I think of the %% proposal yet, but calc() has some issues 
that would need to be ironed out....

-Boris

Received on Friday, 7 May 2004 02:40:43 UTC