3

I have the following:

<a class="nav disabled">Test</a>

Is there some way I can specify the background-color if the address has BOTH the "nav" and "disabled" class markers? In other words a selector that will select only the last of the three below:

<a class="nav">Test1</a>
<a class="disabled">Test2</a>
<a class="nav disabled">Test3</a>
Rubin
  • 375
  • 2
  • 6
  • 12

3 Answers3

5

Yes.

.nav.disabled { .... }

this has side effects in IE6, but is otherwise supported by every browser.

Pekka
  • 442,112
  • 142
  • 972
  • 1,088
2

Concatenate the class selectors:

a.nav.disabled
Dennis
  • 32,200
  • 11
  • 64
  • 79
1

CSS rule for

<a class="nav disabled">Test3</a>

is

a.nav.disabled {}

or

.nav.disabled {}
Arsen K.
  • 5,494
  • 7
  • 38
  • 51