Reset.css覆盖了IE7 / IE6中的colgroup后台 [英] Reset.css is overriding colgroup background in IE7/IE6

查看:144
本文介绍了Reset.css覆盖了IE7 / IE6中的colgroup后台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表,其中列具有不同的背景集由colgroup。然而,在IE6 / 7它完全忽略colgroup背景和采取的单元格的reset.css背景值(这是背景:透明)。我如何解决这个问题,而不必去每个单元格并手动输入背景值?

I have a table where the columns have a different background set by a colgroup. However, in IE6/7 it's completely ignoring the colgroup background and taking the reset.css background value for the cell (which is background:transparent). How can I fix this without having to go to each cell and manually entering a background value?

HTML

<table id="services-table" border="0" cellpadding="0" cellspacing="0" width="100%">
<colgroup>      
 <col class="services-oddcolumn" />         
 <col class="services-evencolumn" />     
</colgroup> 
<tbody>   
  <tr>     
    <td>Column #1, Row #1</td>
    <td>Column #2, Row #1</td>
  </tr>

  <tr>
    <td>Column #1, Row #2</td>
    <td>Column #2, Row #2</td>
   </tr>
</tbody>

重置(位于主CSS文件上方) >

RESET(this is placed above the main CSS file)

html,body, table,tr,th,td {background:transparent;} //it's taking this background value for TD and column

CSS

.services-oddcolumn{background-color:#000 !important; width:10%;} 
.services-evencolumn{background-color:#fff !important; width:10%;}

EDIT 清除修复,我只是改变reset.css文件,所以表,tr,th,td标签被排除在背景:透明属性

EDIT - In the end there's no "clean" fix, I just had to change the reset.css file so table,tr,th,td tags were excluded from background:transparent property

推荐答案

首先,恭喜你甚至知道< colgroup> 标签,更不用说使用它了。它不是在HTML开发人员库中最知名的元素。

Firstly, congratulations on even knowing about the <colgroup> tag, let alone using it. It's not exactly the most well-known element in the HTML developers arsenal.

然而,不幸的是,其中一个不为人所知的原因是它不是很好的支持,并且它听起来像你碰到一个错误,你不能够解决。

Sadly however, one of the reasons it's not very well known is that it is not very well supported, and it sounds like you've hit upon a bug which you're not going to be able to work around.

看看这个页面: http://marc.baffl.co.uk/bugs.php ,并搜索colgroup '。你会发现你会遇到的各种错误的描述,以及一个表,其中的浏览器正常支持它。不幸的是,IE6和IE7在该表的每一列都有no字样。

Have a look at this page: http://marc.baffl.co.uk/bugs.php and search for the word 'colgroup'. You'll find a description of various bugs you'll encounter, along with a table of which browsers support it properly at all. Unfortunately for you, IE6 and IE7 have the word "no" in every column of that table.

如果您打算支持IE6和IE7。

You may have a hard time getting this working if you plan to support IE6 and IE7.


值得注意的是,在IE中这种缺乏支持是特别讽刺的,因为< colgroup&

It's worth noting that this lack of support in IE is particularly ironic given that <colgroup> was originally an IE-specific extension back in the IE4 days.

如果你想支持旧的IE,我的建议是放弃 code>< colgroup> ,只需使用< td> 元素上的类就可以达到同样的效果。

If you want to support older IEs, my suggestion would be to abandon <colgroup> and simply use classes on your <td> elements to achieve the same effect.

这篇关于Reset.css覆盖了IE7 / IE6中的colgroup后台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆