问题描述
我正在尝试使用 CSS 中不太受广泛支持的 :is() 选择器,但在 Less 中,使其得到所有浏览器的支持。但是,我在 Less 中找不到有关此类函数的任何信息。
我想要选择的一个例子是:
input:is([type="checkBox"],[type="radio"]) + label {
cursor: pointer;
text-decoration: underline;
}
<input type="checkBox" id="foo"> <label for="foo">Lorem</label>
<br/>
<input type="radio" id="bar"> <label for="bar">Ipsum</label>
现在我知道 Less 有一种方法可以在没有这样的函数的情况下做到这一点,只需嵌套三个选择器:
input {
&[type="checkBox"],&[type="radio"] {
& + label {
cursor: pointer;
text-decoration: underline;
}
}
}
但对我来说,这似乎是一种非常复杂的方法。
简而言之:有没有办法使用 less 来获得这两个示例中给出的行为,同时不放弃对旧浏览器的支持?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)