superUntitled
superUntitled

Reputation: 22557

Styling when element has two classes

I have been looking at the w3 page on css selectors and have not found any promising leads, so I thought I would ask...

Is there a way to style a single element with two classes differently than if it was one class?

Example:

a.foo {
  color: red;
}

a.bar {
  color: yellow;
}

a.foo.bar {
  color: orange;
}
<a class="foo">Red</a>
<a class="bar">Yellow</a>
<a class="foo bar">Orange</a>

Upvotes: 32

Views: 27110

Answers (1)

meder omuraliev
meder omuraliev

Reputation: 186742

You just answered yourself. Be wary of the IE6 bug.

Upvotes: 26

Related Questions