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
  • 361
  • 2
  • 6
  • 11

3 Answers3

5

Yes.

.nav.disabled { .... }

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

Pekka
  • 431,103
  • 135
  • 960
  • 1,075
2

Concatenate the class selectors:

a.nav.disabled
Dennis
  • 31,394
  • 10
  • 61
  • 78
1

CSS rule for

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

is

a.nav.disabled {}

or

.nav.disabled {}
Arsen K.
  • 5,156
  • 7
  • 36
  • 50