我正在尝试选择除了和之外input的所有元素.typeradiocheckbox
很多人已经表明你可以放入多个参数:not,但是使用type似乎无论如何都没有用到我试试.
form input:not([type="radio"], [type="checkbox"]) {
/* css here */
}
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
我正在尝试使用该:not()属性从规则中排除一对类,例如:
*:not(.class1, class2) { display: none; }
Run Code Online (Sandbox Code Playgroud)
但是,看起来该not()属性不支持逗号分隔的类,如此小提琴中所示.
HTML:
<div class='one'>
foo
</div>
<div class='two'>
foo
</div>
<div class='three'>
foo
</div>
<div class='four'>
foo
</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
div {
background-color: #CBA;
}
div:not(.one) {
background-color: #ABC;
}
div:not(.one, .three) {
color: #F00;
}
Run Code Online (Sandbox Code Playgroud)
应用第一和第二规则,但第三规则不适用.
我做不到,*:not(.class1), *:not(.class2)因为任何元素class2都会被选中,*:not(.class1)反之亦然.
我不想这样做
* { display: none;}
.class1, .class2 { display: inline; }
Run Code Online (Sandbox Code Playgroud)
因为并非所有.class1和.class2元素都具有相同的原始显示属性,我希望它们保留它.
如何使用not()属性或其他方式从规则中排除多个类?