user936965
user936965

Reputation:

CSS :not selector not working?

I've made this screenshot. For some reason the :not selector isn't working? I just don't really get why it isn't working, even though the ul element does have the webmedia-gallery class. Any ideas what I'm doing wrong?

https://jsfiddle.net/gof7oz7e/ screen

Upvotes: 0

Views: 188

Answers (2)

Fabrizio Calderan
Fabrizio Calderan

Reputation: 123367

try to chain your not conditions

ul:not(.languages):not(.webmedia-gallery) li:before {
  ...
}

in fact, if you split your not conditions into multiple selectors, as you did, at least one of them will match. By chaining the conditions you are looking for a list whose classes are not nor .languages neither .webmedia-gallery

Example on CodePen

Upvotes: 2

Eytibi
Eytibi

Reputation: 545

You are using two selectors with :not for one rule, which means one of them is always matching.

The provided fiddle is working fine. Update a bit to have multiple ul's to see how it's working: Fiddle

Upvotes: 0

Related Questions