mjgirl
mjgirl

Reputation: 1234

How can I create a CSS selector for both class and attribute value?

How do I define a CSS style applying to this link with class="disney" and target="_blank"?

  <a class="disney" href="http://www.disney.com" target="_blank">disney.com</a>

Upvotes: 2

Views: 10796

Answers (2)

Chowlett
Chowlett

Reputation: 46667

The following selector should do it:

a.disney[target="_blank"] {
  /* your styles here */
}

Support is basically universal by now - all the major browsers have supported it for a long time. See the MDN documentation.

Upvotes: 2

Krzysztof
Krzysztof

Reputation: 16130

You can try that:

.disney[target="_blank"] {
    color: red;
}

Fiddle: http://jsfiddle.net/4dW2p/

Upvotes: 9

Related Questions