如何在 less 中使用 :not 选择器与当前选择器父级 (&)
How to use :not selector with current selector parent (&) in less
我在应用 :not 选择器和 & in less 时遇到问题。没有 :not the less 工作正常。任何人都可以看看它有什么问题..
HTML:
<div>
<p>Paragraph 1</p>
<p>Paragraph 2</p>
<p class="orange">Paragraph 3</p>
</div>
少:
div {
p {
color: #c0c0c0;
&.orange {
//color: #ff6600; //This works
}
&:nth-child(1), :not(&.orange) { //But with :not, it isn't working...
color: red;
}
}
}
&
必须放在选择器的开头。
&:nth-child(1),
&:not(.orange)
我在应用 :not 选择器和 & in less 时遇到问题。没有 :not the less 工作正常。任何人都可以看看它有什么问题..
HTML:
<div>
<p>Paragraph 1</p>
<p>Paragraph 2</p>
<p class="orange">Paragraph 3</p>
</div>
少:
div {
p {
color: #c0c0c0;
&.orange {
//color: #ff6600; //This works
}
&:nth-child(1), :not(&.orange) { //But with :not, it isn't working...
color: red;
}
}
}
&
必须放在选择器的开头。
&:nth-child(1),
&:not(.orange)