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

On Sat, 8 May 2004, Andrew Fedoniouk wrote:
>
> <P style="text-align: justify">ONE TWO THREE</P>
>
> Here, we have two spaces between the words. 'Justify' line layout will
> try to change the widths of these spaces to place 'one' at the left side
> of space available for the text line.

No, it won't. The 'justify' algorithm is UA dependant. It doesn't apply to
the last line of a block. It is (in the absense of letter-spacing) allowed
to change the spacing between the letters in the lines. It is allowed to
change the wrapping so that lines break at different places so that the
text can be more balanced in its justification. And so forth.


> If so, then the following layout should also be intuitevely clear:
>
> <P>ONE<span style="width:25%%">&nbsp;</span>TWO<span
> style="width:75%%">&nbsp;</span>THREE</P>

'width' doesn't apply to inline elements. But ignoring that, inline layout
is done incrementally. When the first span is renedered, it is not known
how much space remains on the line.


> <div style="width:100px; height:100px; margin:auto;
> background-color:orange">center</div>
>
> margin:auto here means exactly margin:50%%.

No, it doesn't. To start with, 'margin:auto' means different things for
margin-left and -right than for margin-top and -bottom. Secondly, The
meaning of 'auto' depends on the values of the other properties. Thirdly
even in the case given above the meaning of 'auto' changes based on
whether the containing block is wider or narrower than the sum of the
other horizontal properties (width, padding, borders). The meaning changes
based on whether 'direction' is 'ltr' or 'rtl'.

In the simplest case, the definition of margin-left: and margin-right:
auto is "The following constraints must hold among the used values of the
other properties: 'margin-left' + 'border-left-width' + 'padding-left' +
'width' + 'padding-right' + 'border-right-width' + 'margin-right' = width
of containing block ... If both 'margin-left' and 'margin-right' are
'auto', their used values are equal."

That doesn't say anything about "free space", and doesn't at all help me
to determine what your algorithm for "%%" would be.


> %% units should be allowed ONLY in margin and width/height CSS attributes
> for boxes having 'normal' flow.
> Not in absolute nor relative nor fixed positioning mode.

Units always apply. You can't change that. (In particular, there is no way
to enforce different values allowed on one property based on the value of
another.)

I still don't see a definition. Can you explain "%%" without the use of
examples?

-- 
Ian Hickson                                      )\._.,--....,'``.    fL
U+1047E                                         /,   _.. \   _\  ;`._ ,.
http://index.hixie.ch/                         `._.-(,_..'--(,_..'`-.;.'

Received on Sunday, 9 May 2004 05:18:48 UTC