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

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

From: Ian Hickson <ian@hixie.ch>
Date: Sun, 9 May 2004 17:57:34 +0000 (UTC)
To: Andrew Fedoniouk <news@terrainformatica.com>
Cc: www-style@w3.org
Message-ID: <Pine.LNX.4.58.0405091728570.31866@dhalsim.dreamhost.com>

On Sun, 9 May 2004, Andrew Fedoniouk wrote:
>>
>> Using CSS2 (1998):
>>
>>    p { display: table; white-space: nowrap; }
>>    input { display: table-cell; width: 100%; }
>>
>> That should work fine. (If you put a <label> around the text labels, you
>> can then give it 'display: table-cell' as well which would give you finer
>> control over the wrapping.
>
> you are saying "I want my input element to have width 100% of its
> container width"
>
> Right?

No, with the table layout algorithm (as implemented by UAs) width:100%
means "make this column as wide as possible given the constraints of the
other columns".

This is actually very poorly described by CSS2 right now, largely because
nobody actually understands the table layout algorithm, which makes it one
of the worst parts of CSS. Most implementations are developed by reverse
engineering the more popular implementations.


> (Seems like guys in Microsoft are also not getting the idea of this
> "with respect to" table-* styles during last 6 years (since 1998 ?))

Windows Internet Explorer's rendering engine hasn't been updated in years.


> What I am saying here:
>
> <P>from:<INPUT ... style="width:100%%" /></P>
>
> set width of INPUT equal to 100% of  <container width minus space occupied
> by all 'solid' elements in current line>
> 'solid' elements here means all elements having horizontal dimensions in
> units other than %%.
> 'space occupied' means all width+padding+margin+border having values other
> than %%.
>
> Is this formal enough?

It's certainly a lot better than you have explained in the past. What do
you mean by "line" exactly? Are floats and other overlapping elements part
of the "line"? How do you determine what is on a line? What if there is no
line box?


> In this case INPUT.width will be equal to width of paragraph content minus
> width of text "from:"

What if the container width is less than the width of the word "from:"?

-- 
Ian Hickson                                      )\._.,--....,'``.    fL
U+1047E                                         /,   _.. \   _\  ;`._ ,.
http://index.hixie.ch/                         `._.-(,_..'--(,_..'`-.;.'
Received on Sunday, 9 May 2004 14:00:26 GMT

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