I would like to stack more than one class in not() selector but ,;: does not work.
input[type=text]:hover:not(.ui-pg-input .mandatory){ background-color: #D9EDF7;}
So, what is proper way to stack classes in css not() selector?
Two syntactic alternatives:
:not operator: input[type=text]:hover:not(.ui-pg-input.mandatory){background-color: #D9EDF7;}
(note the removed blank between the classes)
:not operator twice: input[type=text]:hover:not(.ui-pg-input):not(.mandatory){background-color: #D9EDF7;}
Note however that both have different meaning: the first uses an or operator, so it matches all elements not having both classes (so having none or one), whilst the second uses an and operator, thus matching all elements not having one or the other class (so having none). So it depends on what you want to do...
You can use twonot() to do this example:
p:not(.class_one):not(.class_two){
p:not(.one):not(.two){
color:red;
}
<p class="one">Text</p>
<p class="two">Text</p>
<p class="three">Text</p>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With