使交替的CSS表行样式在Internet Explorer中工作 [英] make alternating CSS table row style work in Internet Explorer

查看:143
本文介绍了使交替的CSS表行样式在Internet Explorer中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用这个CSS代码在每行第二行颜色重复的行中显示数据库输出

I use this CSS code to display a database output in rows where the colors repeat in every 2nd row

tbody tr:nth-child(2n) td, tbody tr.even td {  
    background: none repeat scroll 0 0 #E5ECF9;  
}



如果我在我的IE中打开它,它不工作。任何建议?

If I open it in my IE it wont work. Any advice?

我使用的是IE 8。

推荐答案

不支持:nth-​​child CSS属性。您可以使用此脚本在IE8中运行:

IE8 does not support the :nth-child CSS property. You can make it work in IE8 with this script:

https://github.com/roylory/ie7-js

如何使用它

您可以通过条件注释包括它,例如:

You can Include it via conditional comments, e.g.:

<!--[if lte IE 9]>
<script src="IE9.js"></script>
<![endif]-->

脚本只能加载到IE9及以下版本,其他浏览器看不到。

The script will only load in IE9 and below, other browsers do not see it.

现场演示: https://jsbin.com/koyahe/edit?html,css,output

(此演示应在所有版本的IE。)

(This demo should work in all versions of IE.)

这篇关于使交替的CSS表行样式在Internet Explorer中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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