IE6-IE9 compatibility problem list and solution _ Supplement 3: Table Col no longer supports style and align, need to go to th, td to set

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.