2012-09-05 40 views
-1

我的CSS规则:为什么这个李:最后孩子不工作?

#menu-right li:last-child a, #menu-left li:last-child a, #menu-bottom li:last-child a, { 
    border: none; 
} 

停止一些变化后的工作,谁能告诉我为什么? testwebsite [已删除]

谢谢!

+0

很难找到您在该页面上讨论的元素。你可以使用http://jsfiddle.net创建一个例子吗? (不需要JS)。 –

回答

2

您的规则有误。不应该有在{,(逗号):

替换:

#menu-bottom li:last-child a, { 

有了:

#menu-bottom li:last-child a { 

还要注意的是,:last-child选择不使用Internet Explorer 6的工作, 7和8!

+0

':last-child'伪类仍然无法在浏览器中可靠地使用。尤其是,Internet Explorer版本<9,Safari <3.2肯定[不支持它](https://developer.mozilla.org/en/CSS/:last-child#Browser_compatibility),尽管Internet Explorer 7和Safari 3.2 *好奇地支持':first-child'。 –

+0

Arrrgh。谢谢!那么我会转向第一个孩子。 –

+0

有同样的问题哥们,最后都变成了'第一胎'。 :) –

1

#menu-bottom li:last-child a, {替换为#menu-bottom li:last-child a {。你的规则中有一个逗号,正在打破它。

+1

就是这样。谢谢! –

相关问题