2009-04-10 47 views
0

根据css3.info的selector test,Firefox 3.0支持第n个子选择器的一些排列。但是,显示的代码here(#30)不适用于我。Firefox的CSS3“nth-child”支持?

它应该选择空段落,所以我编辑我的代码到以下,但它不显示在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

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

+0

已验证 - Safari 3代码有效。 FF 3它没有。 div与div之间也有区别:nth-​​child(偶数)和div:n-child(偶数) – 2009-04-10 17:21:39

+0

我刚刚测试了3.0.8,结果如下:nth-​​child()(88中有47个失败)。 其中包括:n-child(偶数) – 2009-04-10 17:22:05

1

,如果你使用jquery this可能会帮助你(jQuery的不关心你的用户使用的是什么浏览器:))

1

在Firefox 3.5中,你的测试用例现在将按预期。