下面是HTML佈局如何寫這個:不是「在其他元素」的CSS規則?
<div class="wrap">
<div class="section">
<span class="text">text1</span>
</div>
<span class="text">text2</span>
<span class="not-text">don't color me!</span>
</div>
我試着給一個樣式到所有「文本」跨越這是不是在「節」的div。 我想這一點,但它似乎並不奏效
.wrap :not(.section) .text
任何幫助,不勝感激!
編輯:這種情況下有幾種解決方法,包括使用>運算符,如「.wrap> .text」,但我想知道如何使:not選擇器工作,以利用它在未來
'.wrap> .text'會的工作,但是這欺騙.. – 2013-02-14 23:04:44