W3C home > Mailing lists > Public > www-style@w3.org > May 2004

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

From: Andrew Fedoniouk <news@terrainformatica.com>
Date: Sat, 8 May 2004 17:10:30 -0700
Message-ID: <002a01c4355a$0a4d1890$0301a8c0@ATHLON>
To: "Ian Hickson" <ian@hixie.ch>
Cc: <www-style@w3.org>

>
> Could you please define, in terms given in the CSS specification, the
> exact algorithm you are proposing to determine the "free space" for any
> given dimension of an element in a layout?
>
> In particular, how do nested floats, positioned elements in sibling
> containing blocks, overflow content from cells in non-sibling tables, and
> so forth, affect the "free space"?
>

I am not too strong in formal English, and especially in specifications.
Nevertheless...

Let's say we have some text:

<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. The word 'three' will be placed at right
side of space available for the text line. Word 'two' will appear somewhere
in the middle. Therefore, the spaces here will behave exactly as two XUL's
<spacer flex="50" /> between the words, or two <span
style="width:50%%">&nbsp;</span>

Is this clear?
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>

The rules for %% units/layout are already "defined" in CSS (see
text-align:justify) or "well known" for existing UAs.

One more illustration (margin:auto supported by Mozilla):

<div style="width:100px; height:100px; margin:auto;
background-color:orange">center</div>

margin:auto here means exactly margin:50%%. (At least Mozilla knows about
"free space" concept)
(with exception: margin:50%% will force div content box to appear in the
middle of the screen verticaly also)

%% 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.

Andrew Fedoniouk.
http://terrainformatica.com
Received on Saturday, 8 May 2004 20:10:04 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:29 GMT