Skip to content Skip to sidebar Skip to footer

IE9.0 And Colgroup / Colspam Issue

IE 9.0 does not render following HTML correctly and I am out of ideas...... Please help. I CANNOT change '< !DOCTYPE html >'. any ideas ? Thanks. &l

Solution 1:

Colspan = number of columns to combine into a single cell. I am affraid you use it to set width of a column. And that's wrong. Use CSS width property to set width of a column.

<td width="120" colspan="3">

(that was plain HTML) or with CSS

<td style="width:120px" colspan="3">


Solution 2:

The markup violates the HTML table mode, as the W3C Markup Validator would tell you, in its somewhat cryptic way. The colspan attribute specifies the number of table columns that a cell spans. You cannot span 120 columns when there are only 3 columns.

It seems to me that what you really want is to divide the available width between the columns so that the relations are 15 : 15 : 90. Simplify this to 1 : 1 : 6 and then turn them to percentages:

<table style="table-layout:fixed;" width="100%" border="1">
     <col width="12.5%">
     <col width="12.5%">
     <col width="75%">
    <tbody>
        <tr>
            <td colspan="3">AAAAAAAAAAAAAAAAAAAAAA</td>
        </tr>
        <tr>
            <td>aa</td>
            <td>ss</td>
            <td>dd</td>
        </tr>
        <tr>
            <td colspan="3">zzzzzzzz</td>
        </tr>
    </tbody>
</table>

Using fixed layout, the widths of columns are determined when the first row is processed. Therefore, the widths need to be set in col elements. Otherwise, the browser, when processing the first row, would not have any width requirements, so it would, by the specs, divide the total space evenly between the columns.


Post a Comment for "IE9.0 And Colgroup / Colspam Issue"