3
此代碼::延伸()中嵌套塊
.first {
margin: 19px;
.nested {
color: white;
}
}
.second:extend(.first) {
}
輸出:
.first,
.second {
margin: 19px;
}
.first .nested {
color: white;
}
但是,如果你把它包裝在另一個塊:
div {
.first {
margin: 19px;
.nested {
color: white;
}
}
.second:extend(.first) {
}
}
輸出:
div .first {
margin: 19px;
}
div .first .nested {
color: white;
}
無視延長?這是一個錯誤?
不,這不是一個錯誤。 'extend'與它所用的選擇符不相關,'extend'總是需要完整的(「絕對」)選擇器「路徑」。即它應該是'.second:extend(div .first)',而不管'.second'本身位於何處。 –
謝謝,這工作!你能否將它作爲答案發布?我會批准它。 :) – Annie
嘗試在問題的標題中更具體地描述問題。 –