In IE6 and IE7, if you want to hide a column in a table, you can set a style = "display: none" in col,CodeAs follows:
<Table>
<Colgroup>
<Col align = "Left" width = "80"> </COL>
<Col align = "right" width = "50" style = "display: none"> </COL>
</Colgroup>
<Thead>
<Tr>
<TH> Student name </Th>
<TH> Student ID </Th>
</Tr>
</Thead>
<Tbody>
<Tr>
<TD> JOHN </TD>
<TD> 1 </TD>
</Tr>
</Tbody>
</Table>
However, some versions of IE8 are not supported, and ie9 is also not supported. For more information, see the following section.Article:
He1004: IE8 (s) Firefox Chrome Safari Not Supported Col And Colgroup Partial attributes of an element and CSS Features Http://www.w3help.org/zh-cn/causes/HE1004
The following table compares the elements supported by Col in different browsers:
In ie9, although the align and style attributes of Col are not supported, the width attribute is also supported. In HTML5, width is not supported in col, and ie10 supports width, however, with IE's increasing support for HTML5, it's hard to say whether it can support width in ie11.
Therefore, the solution is to discard setting styles in colgroup and Col and directly set them in TD and Th.
As shown in the following codeAboveAlign, width, style,InTDYou only need to setStyleYou can.
<Table>
<Colgroup>
<Col align = "Left" width = "80"> </COL>
<Col align = "right" width = "50"> </COL>
</Colgroup>
<Thead>
<Tr>
<TH align = "Left" width = "80"> Student name </Th>
<TH align = "right" width = "50" style = "display: none"> Student ID </Th>
</Tr>
</Thead>
<Tbody>
<Tr>
<TD> JOHN </TD>
<TD style = "display: none"> 1 </TD>
</Tr>
</Tbody>
</Table>
There is an increasing sense that ie9, in addition to its name, is also called ie. the content in it, haha, can be said to have completely changed.