2012-09-05 41 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

就是這樣。謝謝! –

相關問題