gpt4 book ai didi

javascript - CSS tr 背景不适用于 IE7

转载 作者:太空宇宙 更新时间:2023-11-04 05:15:46 26 4
gpt4 key购买 nike

tr 背景属性似乎在 IE7 中不起作用。我想让行的 bgcolor 交替,然后当鼠标在行上时让它有不同的颜色。所以我不能使用表 tbody tr.d1 td{background:#f1f1f1;} 因为 tbody tr.d1 td:hover{background:#f1f1f1;} 只会影响单元格的颜色,而不是整行...有人知道如何使这段代码工作吗?:

<html>
<head>
<script type="text/javascript" src="http://www.kryogenix.org/code/browser/sorttable/sorttable.js" ></script>
<style type="text/css">
table tbody tr.d1 td{background:transparent;}
table tbody tr.d2 td{background:transparent;}
table tbody tr.d1{background:#f1f1f1; color:#363636;}
table tbody tr.d2{background:white; color:#363636;}
table tbody tr.d1:hover, tr.d2:hover{background:#FFF5C3; color:#FF7260;}
</style>
</head>
<body>
<table class="sortable">
<thead>
<tr>
<th >Index</th>
<th><span class="nowrap">Parameter Name</span></th>
<th><span class="nowrap">Parameter Value</span></th>
<th><span class="nowrap">Page Name</span></th>
<th ><span class="nowrap">Page Name</span></th>
<th ><span class="nowrap">Page Name</span></th>
<th ><span class="nowrap">Page Name</span></th>
<th class="sorttable_nosort scrollbarCol"></th>
</tr>
</thead>
<tbody>
<tr class="d1">
<td>4_1</td> <td>gfryn</td> <td>4_2</td> <td>4_3</td> <td>4_3</td> <td>4_3</td> <td>4_3</td>
</tr>
<tr class="d2">
<td>4_2</td> <td>aegr</td> <td>4_2</td> <td>4_3</td> <td>4_3</td> <td>4_3</td> <td>4_3</td>
</tr>
<tr class="d1">
<td>4_3</td> <td>ryj</td> <td>4_2</td> <td>4_3</td> <td>4_3</td> <td>4_3</td> <td>4_3</td>
</tr>
<tr class="d2">
<td>4_4</td> <td>styj</td> <td>4_2</td> <td>4_3</td> <td>4_3</td> <td>4_3</td> <td>4_3</td>
</tr>
<tr class="d1">
<td>4_5</td> <td>rth</td> <td>4_2</td> <td>4_3</td> <td>4_3</td> <td>4_3</td> <td>4_3</td>
</tr>
<tr class="d2">
<td>4_6</td> <td>srhfr</td> <td>4_2</td> <td>4_3</td> <td>4_3</td> <td>4_3</td> <td>4_3</td>
</tr>
<tr class="d1">
<td>4_7</td> <td>sryh</td> <td>4_2</td> <td>4_3</td> <td>4_3</td> <td>4_3</td> <td>4_3</td>
</tr>
<tr class="d2">
<td>4_8</td> <td>et5h</td> <td>4_2</td> <td>4_3</td> <td>4_3</td> <td>4_3</td> <td>4_3</td>
</tr>
</tbody>
</table>
</body>
</html>

[编辑]
javascript workarround 会是什么样子?

最佳答案

IE7 总是很头疼,我不知道为什么 IE7 以这种方式理解 background:transparent 但是 *background-color:none 终于可以工作了:

http://jsfiddle.net/NAGyt/1/

对于 td:hover 我希望这对您有所帮助:

http://jsfiddle.net/NAGyt/2/

无论如何,看看these links有关 IE7 中 :hover 的更多信息。

关于javascript - CSS tr 背景不适用于 IE7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8154560/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com