6

Possible Duplicate:
Can you target an element with CSS only if 2 classes are present?
CSS Selector that applies to elements with two classes

Is there a way to apply a CSS style to an element only if 2 classes are applied to it?

For example, apply my custom styles to this:

<div class="one two">Text</div>

But not to these:

<div class="one">Text</div>
<div class="two">Text</div>
Community
  • 1
  • 1
Dzhuneyt
  • 7,757
  • 13
  • 60
  • 112

2 Answers2

14

Sure:

.one.two { border: 1px red solid }
Jon
  • 413,451
  • 75
  • 717
  • 787
2

Try to use in css selector .one.two

Danil Speransky
  • 28,931
  • 5
  • 62
  • 77