Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I combine two :not()s?

I'm trying to do something like this:

:not(h1) > a,
:not(figure) > a {
    background: #859900;
}

But it doesn't work, because figure>a catches :not(h1)>a and h1>a catches :not(figure)>a. How can I combine those?

like image 431
betseg Avatar asked Sep 07 '25 12:09

betseg


1 Answers

Combine the two :not() selectors, just as a selector for .class-a AND .class-b is .class-a.class-b.

:not(h1):not(figure) > a {
  color: red;
}
<h1><a>Test</a></h1>
<p><a>Test</a></p>
<figure>
  <a>Test</a>
</figure>
like image 136
LarsW Avatar answered Sep 10 '25 05:09

LarsW