Dims
Dims

Reputation: 50999

Why column widths are ignored?

Why does column widths are ignored here?

http://jsfiddle.net/dimskraft/M4Hn5/

<table class="menu">
    <colgroup>
        <col style="width:50%"/>
        <col style="width:50%"/>
    </colgroup>
    <tr>
        <td>ORION</td>
        <td>
            <table>
                <tr>
                    <td>Home</td>
                    <td>About</td>
                    <td>Subscribe</td>
                </tr>
            </table>
        </td>
    </tr>
</table>

CSS

body {
    font-family: Arial, Helvetica, serif;
    color: darkgray;
    background-color: gray;
    font-size: 12px;
}
h1 {
    color: black;
    font-size: 14px;
}
table 
{
    width: 900px;
}
table.menu td {
    height: 100px;
    background-color: white;
}

Upvotes: 0

Views: 57

Answers (1)

Gavin
Gavin

Reputation: 7944

In your CSS, you have table { width: 900px; }, but then in a TD you have an embedded table. This table is also being set to 900px, which is stretching its parent TD to be the entire width of the .menu table. Change that part of the CSS to table.menu { width: 900px; }

Upvotes: 1

Related Questions