Ivan Topić
Ivan Topić

Reputation: 3185

Target element with target which isn't a specific class

How can I target a link with _BLANK target but which doesn't have specific class?

a[target="_BLANK"] {
   // Do something if this link isn't .skip-this class
}

Upvotes: 1

Views: 46

Answers (1)

Hunter Turner
Hunter Turner

Reputation: 6894

Simply use the CSS :not selector

CSS

a[target="_BLANK"]:not(.skip-this) {
   color: red;
}

a[target="_BLANK"]:not(.skip-this) {
   color: red;
}
<a href="" target="_BLANK" class="skip-this">Hello</a>
<a href="" target="_BLANK">Hello</a>

Upvotes: 3

Related Questions