tags:

views:

66

answers:

3

Hello,

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

+2  A: 

Try with there rules:

a:focus { background-color: #eeeeee; }
.audio_wrapper a:focus {background-color: #000000}; <!-- or white or what is your default color-->
anthares
A: 

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... }

Jimmy Cuadra
A: 

The not selector is only supported by modern browsers (Firefox, Safari and Opera) and not IE.

a:not(.audio_wrapper){ background-color: #eeeeee; ............}

Matt
That won't work because it excludes `a` elements that do not have a class of "audio_wrapper." In poru's case he wants to exclude `a` elements within a parent element that has a class of "audio_wrapper."
Jimmy Cuadra