Firefox的CSS3“n-child”支持?

时间:2009-04-10 17:14:06

标签: firefox css-selectors css3

根据css3.info的selector test,Firefox 3.0支持nth-child选择器的一些排列。但是,显示here(#30)的代码对我不起作用。

它应该选择空段落,所以我将我的代码编辑为以下但它没有在Firefox中显示(它在Opera中有效)。

<style type="text/css">
div :nth-child(even) {
    background-color: yellow;
    height: 30px;
}
</style>

<div>
    <div>Does this element match?</div>
    <div></div>
    <div>Does this element match?</div>
    <div></div>
</div>

这是测试中的错误,还是我在某个地方犯了错误?

3 个答案:

答案 0 :(得分:3)

嗯...根据this page Firefox 3.0不支持:nth-child

答案 1 :(得分:1)

如果您使用jquery this可能会帮助您(jquery不关心您的用户使用的浏览器:))

答案 2 :(得分:1)

在Firefox 3.5中,您的测试用例现在可以正常运行。