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

Re: How percentage heights could have worked (and maybe still could)

From: Andrew Fedoniouk <news@terrainformatica.com>
Date: Wed, 25 Nov 2009 23:35:27 -0800
Message-ID: <4B0E2FBF.8070504@terrainformatica.com>
To: "L. David Baron" <dbaron@dbaron.org>
CC: www-style@w3.org
L. David Baron wrote:
> After seeing another set of complaints about how percentage heights
> don't do what authors want in CSS, I had an idea about how they
> could have worked better.
> 

In fact in most cases when people are asking for better percentage 
heights handling they mean flex units - not percents.

If to speak about percents per se then here is another possible way of 
their computation.

For the given DOM [sub]tree do:

Phase I. "Initial calculation". Compute all length values as usual to 
get dimensions of all elements.

So if some container has 'height:auto' then all children that have
percentage heights will have them treated as height:auto at this phase.

Phase II. "Fixed lengths". Use dimensions computed at phase I as input 
values (in your terms) of percentable heights that were replaced by the 
'auto' value in Phase II.

(I suspect that Phase I together with Phase II is just a paraphrase of 
the algorithm defined in your message)

And if your UA support flex units in one form or another do:

Phase III. "Flexes and final replacement".
At this moment we know min/max widths of all containers and their 
children so we can compute values of attributes given in flex units.


-- 
Andrew Fedoniouk.

http://terrainformatica.com
Received on Thursday, 26 November 2009 07:36:02 GMT

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