Limit table column width in IE6

I have a 2×2 table coded like this:

<table>
<tr>
<th id="r1c1">
Short heading
</th>
<th id="r1c2">
Short heading
</th>
</tr>
<tr>
<td id="r2c1">
Very very long content blah blah blah
</td>
<td id="r2c2">
Short content
</td>
</tr>
</table>

In the td cell r2c1, if the content does wrap, it takes more width than r1c1, say r1c1 requires 100px width, and r2c1 requires 300px.

But I want r2c1 content words wrap and its width limits to 100px. I put width style in the first row, i.e.:

<th id="r1c1" style="width:100px">

It does not work in IE6.

Then I put width attribute on col, i.e.:

<table>
<col width="100"/>
<col width="100"/>
...

It does not work in IE6, either.

Then I put width attribute in r2c1, i.e.:

<th id="r2c1" width="100">

It does not work in IE6, either.

At last, I put width style in r2c1, i.e.:

<th id="r2c1" style="width:100px">

Finally it works in IE6.

I knew td’s width attribute is deprecated but I didn’t know deprecated IE6 does not read deprecated attribute.

Leave a comment

Your email address will not be published. Required fields are marked *