If you're using SASS in your project, I've built this mixin to make it work the way we all want it to:
@mixin not($ignorList...) {
@if (length($ignorList) == 1){
$ignorList: nth($ignorList,1);
}
$notOutput: '';
@each $not in $ignorList {
$notOutput: $notOutput + ':not(#{$not})';
}
&#{$notOutput} {
@content;
}
}
it can be used in 2 ways:
Option 1: list the ignored items inline
input {
@include not('[type="radio"]','[type="checkbox"]'){
}
}
Option 2: list the ignored items in a variable first
$ignoredItems:
'[type="radio"]',
'[type="checkbox"]'
;
input {
@include not($ignoredItems){
}
}
Outputted CSS for either option
input {
}
input:not([type="radio"]):not([type="checkbox"]) {
}