0
我有一個HTML結構如下:選擇元件在家長少用CSS
<div class="container">
<label>Name:</label>
<div class="controls">
<input type="text" class="formatted-input"></input>
</div>
</div>
我只能訪問到「格式輸入」級。我需要一種方式,從這個班級到最外面的父母的標籤,並將格式應用到它。這可能使用LESS CSS嗎?
我想出這樣的事情:
.container .formatted-input
{
& & > label {
color: yellow;
}
}
,但它不工作。有什麼建議麼?
謝謝!
爲什麼爲什麼爲什麼爲什麼?看看這裏:http://stackoverflow.com/questions/1014861/is-there-a-css-parent-selector – thatidiotguy
LESS只編譯爲正常的,有效的,標準的CSS - 所以如果它不能在CSS中完成它可以不能用LESS來完成(並且當前不能用CSS完成「父/上一級兄弟選擇器」)。 –