CSS伪类回退? [英] CSS pseudo-class fallback?
本文介绍了CSS伪类回退?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想为表使用 tr:nth-child(even / odd)
伪类,但我想支持IE 2 。那么,是否有任何纯CSS方式添加边框到 tr
如果 nth-child
不支持? / p>
解决方案
您可以尝试 Selectivizr < a>,我认为这是最简单的解决方案。
编辑:
您也可以使用jquery for:
$(function(){
$(tr:odd)。addClass );
$(tr:even)addClass(even);
});
EDIT2:
使用Modernizr,您可以尝试此。 p>
EDIT3:)
tr {border-bottom:1px solid #ccc ; }
tr:nth-child(odd),
tr:nth-child(even){border:none; }
tr:nth-child(odd){background:#eee; }
tr:nth-child(even){background:#ddd; }
I'd like to use the tr:nth-child(even/odd)
pseudo class for a table, but I want to support the IE 2 population as well. So, is there any purely css way to add a border to tr
if nth-child
isn't supported?
解决方案
You can try Selectivizr, I think that's the easiest solution.
EDIT:
You could also use jquery to add classes for you:
$(function() {
$("tr:odd").addClass("odd");
$("tr:even").addClass("even");
});
EDIT2:
Also, if you're using Modernizr, you could try this.
EDIT3 :)
tr { border-bottom: 1px solid #ccc; }
tr:nth-child(odd),
tr:nth-child(even) { border: none; }
tr:nth-child(odd) { background: #eee; }
tr:nth-child(even) { background: #ddd; }
这篇关于CSS伪类回退?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文