BurninLeo
BurninLeo

Reputation: 4474

IE ignores one col's width if there is no unspanned cell

My problem is quite easily demonstrated:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
<table border="1">
    <colgroup>
        <col width="75">
        <col width="75">
        <col width="75">
        <col width="75">
    </colgroup>
    <tr>
        <td colspan="2">Cells 1 + 2</td>
        <td colspan="2">Cells 3 + 4</td>
    </tr>
</table>
</body>
</html>

While Firefox (15.0.1) creates a table with two cell's, each 150 pixels...

Result in Firefix

... Internet Explorer (9.0.8112.16421) uses only col three for the width:

Result in IE

As soon as the table contains a row with a cell in the fourth column that does not span over another one, the width definitions work as expected.

I guess that IE things to itself "oh, well, there is no other colum behind the third one - let's ignore the col definition". But I have no idea how to avoid this problem. Any suggestions? And, of course, explanations that go beyond tele-introspection are welcome as well :)

To avoid discussions regarding this example's sense: The columns are defined automatically by a function that does not know if the latter cells will be used separately (at least once) or not.

Upvotes: 1

Views: 675

Answers (1)

Diodeus - James MacFarlane
Diodeus - James MacFarlane

Reputation: 114367

Set a width for the TABLE itself.

<table border="1" width="300">

Upvotes: 0

Related Questions