Vlant Vlant - 6 months ago 12
CSS Question

css selector : all except ones in

I'm having trouble using css selector. I would like to select all class "container", that are not in a parent "nav" :

<body>
<nav>
<div class="container"></div>
</nav>
<div class="container"></div>
<div class="container"></div>
<div class="container"></div>
...
</body>


Is this possible using css selector ?

SOLUTION : the solution (thx Noah) :
:not(nav) > .container {/** out your v=css here */}
. This work if .container is direct child of nav element.

Answer
:not(nav) > .container

Note that this won't work if the container isn't directly within the nav, but there are ways around that.