Re: CSS: %% length unit. Proposal. Some clarifications.

Hi, Mikko,

<p>1 2 3 4 5 <span /> 6 7 8 9<p>
and style
span { width: 80%%; }

See:
first:
   compute everything as %% does not exist at all.
   apply all paragraph wrapping rules as usual.
second:
   compute free space for each line box which we've got on first step.
   compute all elements which have %% according to free space.
   replace elements in line boxes.

In example given above line box having such 80%% <span/> will always has 20%
of free space unoccupied.

And I cannot see any problems with

span { min-width: 2em; }

this span will be computed in first step as having width 2em;

Example:
http://terrainformatica.com/w3/p2/width1.jpg

And here is first paragraph (with three inputs was wrapped into two line
boxes)
http://terrainformatica.com/w3/p2/width3.jpg
Second line has 70% of free space unoccupied.


Andrew Fedoniouk.
http://terrainformatica.com


> > %% units calculation rule:
> >
> > Two steps calculation:
> > 1) mincontentwidth = minimum width of all elements in the line box.
(dont
> > count attributes with %% at this step)
> > freespacewidth = containercontentwidth - mincontentwidth. (
> > containercontentwidth is known at this step)
> > 2) change all attributes in all elements having %% units value according
> > this value and freespacewidth  (percent calculation) .
>
> OK. With markup like this
>
> <p>1 2 3 4 5 <span /> 6 7 8 9<p>
>
> and style
>
> span { width: 80%%; }
>
> what belongs in the *first* "line box"? If the minimum combined
> width of the words from "1" to "9" is just equal to the container
> width I assume that the 'freespacewidth' is zero. So the span should
> have computed width of zero? Or is it something else?
>
> If we add rule
>
> span { min-width: 2em; }
>
> that just makes the span 2em width because it would otherwise have
> narrower computed value (see above).
>
> You see, the problem is, when to drop the rest of the inline items
> to *next* "line box" and use remaining space for the "%%" unit? I
> think the default behavior is to put everything in the first line
> box that fits in (greedy algorithm).
>
> IMO, the "%%" unit is clearly defined only if all of the containers
> content fit in one line. And for a such a special case, I think we
> can come up with something better than "%%".
>
> -- 
> Mikko
>

Received on Tuesday, 11 May 2004 16:21:12 UTC