I have a CSS that looks like this:
a:focus { background-color: #eeeeee; }
Now in CSS3 there’s the not() attribute.
How could I work with this when I want add the focus-background-color to all elements
but with one exception: I want that this isn’t added to a-tags/elements inside .audio_wrapper
The :not pseudo-class won’t help you in this situation because it only accepts simple selectors, and your condition relies on an attribute of the
a‘s parent. The best solution is just to define the rule and then override it with a second rule for the conditional case.Edit: On Second thought, you might be able to do it like this:
:not(.audio_wrapper) a:focus { ...rules... }