W3C home > Mailing lists > Public > www-style@w3.org > July 2006

Elements styled with width:value% inside a table with width="auto"

From: Shadow2531 <shadow2531@gmail.com>
Date: Mon, 10 Jul 2006 05:51:35 -0400
Message-ID: <6b9c91b20607100251k298e94d2kc4dbdfead3366b95@mail.gmail.com>
To: www-style@w3.org

What must happen in these situations?

<!DOCTYPE html>
<html>
    <head>
        <title>Use cols as backup</title>
        <style>
            td textarea {
                width: 100%;
            }
        </style>
    </head>
    <body>
        <table>
            <tr>
                <td><textarea cols="300"></textarea></td>
            </tr>
        </table>
    </body>
</html>

The textarea is styled with width: 100% and the table has a width of
auto.  The textarea needs to know the width of the table so 100% can
mean something, but the table needs to know the width of the textarea
so the table can fit -to-width.  A calculation can't be made.

What should happen?

Should the UA use the cols attribute as a backup?

If so, how *exactly* should it be used?

Should the end result be a textarea that has a static width of 300
columns or should the end result be that the table has width: 100% and
a max-width of whatever 300 columns calculates to in pixels?

Gecko and KHTML do the latter, which makes the textarea have a
variable width. Opera and IE don't do either and just display the
textarea borders and scrollbars. If the table's borders and padding
are collapsed, Opera won't display anything.

Now, here's the same situation, but with a 1400 x 20 image:

<!DOCTYPE html>
<html>
    <head>
        <title>Use intrinsic width as backup</title>
        <style>
            td img {
                width: 100%;
            }
        </style>
    </head>
    <body>
        <table>
            <tr>
                <td><img
src="http://shadow2531.com/opera/testcases/tables/002.png"></td>
            </tr>
        </table>
    </body>
</html>

Should the intrinsic width of the image be used as a backup?

Gecko and KHTML make the table have a width of 100% and use the
intrinsic width of the image to apply a max-width of 1400px. to the
table. The end result  is that the pic has a variable width. However,
the height of the pic is also variable.

Opera here doesn't display the image at all.

What *exactly* should happen?

Must  the end result be that the pic has a static width of 1400px and
a static height of 20px or is the Gecko and KHTML behavior correct?

Note: There seems to be a little more to what  Gecko and KHTML do
(like padding, borders, margins etc.), but what I decribed is
basically what they do..

Thanks

-- 
burnout426
Received on Monday, 10 July 2006 15:32:29 GMT

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