Mark R
Mark R

Reputation: 567

Table columns to be fixed width no matter what content?

When I create a table with two colums and start inputting data on one side the other side gets smaller and vice versa.

I've set the table rows to be 50% width and it still does this.

How do I stop them from changing size and stay 50% widht of their container?

Thanks

Upvotes: 1

Views: 1083

Answers (3)

Rick Hoving
Rick Hoving

Reputation: 3575

You can also try this:

<table border="1">
    <col width=100>
    <col width=100>
<tr>
    <td>row 1, cell 101234</td>
    <td>row 1, cell 2</td>
</tr>
<tr>
    <td>row 2, cell 1</td>
    <td>row 2, cell 2</td>
</tr>
</table>​

Upvotes: 0

tdammers
tdammers

Reputation: 20721

The CSS property table-layout: fixed; should take care of this. Also, make sure you're not running in Quirks Mode (that is, add a correct DOCTYPE specification to your HTML document).

Upvotes: 0

Caleb Doucet
Caleb Doucet

Reputation: 1781

Try:

#table
{
    table-layout: fixed;
}

where "table" is the id of the table

Upvotes: 1

Related Questions