的following example的作品,而不是:CSS:不能在Firefox 4在Internet Explorer 8中解決辦法的Internet Explorer
HTML:
<div class='first'>A</div>
<div>B</div>
<div>C</div>
CSS:
div:not(.first) {
color: red;
}
什麼解決方法是你建議讓它在兩個瀏覽器中都能正常工作?
的following example的作品,而不是:CSS:不能在Firefox 4在Internet Explorer 8中解決辦法的Internet Explorer
HTML:
<div class='first'>A</div>
<div>B</div>
<div>C</div>
CSS:
div:not(.first) {
color: red;
}
什麼解決方法是你建議讓它在兩個瀏覽器中都能正常工作?
爲什麼你不能做到這一點?:
div {
color: red;
}
div.first {
color: inherit;/* or whatever color you want*/
}
這是不是一個真正的:not()
的解決方法,但據我可以告訴適用於你的榜樣。如果你沒有課,你也可以使用:first-child
。
非常感謝! – 2011-04-27 12:20:28
並不完美,但工作原理:
div {
color: red;
}
div.first {
//some other colour
}
編輯:或者有什麼madmartigan說
不回答你的問題,但在上面的代碼,你可以使用':一線兒童'選擇器而不是'class ='first'' – Spudley 2011-04-27 12:13:49
[IE9.js](http://code.google.com/p/ie7-js/)似乎在IE中實現了這個選擇器... – 2011-04-27 12:14:22