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
  • 8,437
  • 14
  • 64
  • 118

2 Answers2

14

Sure:

.one.two { border: 1px red solid }
Jon
  • 428,835
  • 81
  • 738
  • 806
2

Try to use in css selector .one.two

Danil Speransky
  • 29,891
  • 5
  • 68
  • 79