2

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>
0

2 Answers 2

9

You can try that:

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

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

Sign up to request clarification or add additional context in comments.

2 Comments

No need to judge each other language skills I think.It does not say that it needs to be targeted in css. However this does not work if you have style selector a[target="_blank" aswell. How to overwrite that?
It works - example: jsfiddle.net/4dW2p/1 You can try adding !important to example color: red !important if you have problem.
2

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.