I'm trying to select input
elements of all type
s except radio
and checkbox
.
Many people have shown that you can put multiple arguments in :not
, but using type
doesn't seem to work anyway I try it.
form input:not([type="radio"], [type="checkbox"]) {
/* css here */
}
Any ideas?
If you're using SASS in your project, I've built this mixin to make it work the way we all want it to:
it can be used in 2 ways:
Option 1: list the ignored items inline
Option 2: list the ignored items in a variable first
Outputted CSS for either option
Starting from CSS 4 using multiple arguments in the
:not
selector becomes possible (see here).Example:
Unfortunately, browser support is limited. For now, it only works in Safari.
Why :not just use two
:not
:Yes, it is intentional
If you install the "cssnext" Post CSS plugin, then you can safely start using the syntax that you want to use right now.
Using cssnext will turn this:
Into this:
http://cssnext.io/features/#not-pseudo-class
I was having some trouble with this, and the "X:not():not()" method wasn't working for me.
I ended up resorting to this strategy:
It's not nearly as fun, but it worked for me when :not() was being pugnacious. It's not ideal, but it's solid.