[英]How to write LESS selector that targets buttons not disabled?
索引.html :
<div>
<span>
<button disabled>
Button 1
</button>
<button>
Button 2
</button>
</span>
</div>
index.less :
:not(&[disabled]) button {
background-color: red;
}
这给出了以下输出。 两个按钮都是红色的,但我试图只针对未禁用的按钮。
有没有办法做到这一点? 我特别希望针对未禁用的按钮。
这是jsfiddle: https ://jsfiddle.net/6gqb19e3/36/
我是 LESS 的新手,我的语法错误。 经过一番试验和错误,我想出了这个:
button {
background-color: grey;
&:not([disabled]) {
background-color: green;
}
}
这是 jsfiddle: https ://jsfiddle.net/6gqb19e3/81/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.