選擇div是否有任何CSS選擇器選擇一個父div只有當它直接包含選擇裏面?只有當它包含選擇
示例代碼:
<div class="top_level">
<input type="radio"></input>
</div>
<div class="top_level">
<input type="text"></input>
</div>
<div class="top_level">
<select name="namehere">
<option>...</option>
<option>...</option>
<option>...</option>
</select>
</div>
假設我只想選擇第三個3 top_level
類的div,因爲它包含一個選擇直接在它裏面,我會怎麼做呢?
我曾嘗試搜索周圍的答案,但無法找到任何。如果在CSS中可以選擇父項,那將會容易得多。
的可能重複[是否有一個CSS家長選擇?] (http://stackoverflow.com/questions/1014861/is-there-a-css-parent-selector) – grc
我想這個問題可能看起來相似,但我沒有技術上要求在這裏的父母選擇器。我問是否可以根據它包含的內容來選擇一個元素。從技術上講,他們是我想的不同的問題。 – Ahmad