Reputation: 115
is possible change color external links inside some class? I tried this:
.space-page-content a {
background: green;
color: white;
}
.space-page-content a[href^="http://"]:not([href*="mywebsite.com"]):after,
.space-page-content a[href^="https://"]:not([href*="mywebsite.com"]):after{
background: blue;
color: white;
}
<a style="space-page-content" href="http://www.mywebsite.com/page-1/" >internal</a><br>
<a style="space-page-content" href="http://www.google.com" >external</a><br>
<a style="space-page-content" href="http://www.mywebsite.com" >internal</a>
Upvotes: 1
Views: 199
Reputation: 1422
You have some errors in your CSS and HTML code,
.space-page-content
defined as class, while in your HTML its something else..space-page-content a
, this means that a
is a child inside your parent .space-page-content
. But in fact, your HTML says that this class is given to a
, so you should say select 'a' that has class 'space-page-content' by this way a.space-page-content
without any spaces between a
and your class.a
, so no need to add :after
.a.space-page-content{
background: green;
color: white;
}
a.space-page-content[href^="http://"]:not([href*="mywebsite.com"]),
a.space-page-content[href^="https://"]:not([href*="mywebsite.com"]){
background: blue;
color: white;
}
<a class="space-page-content" href="http://www.mywebsite.com/page-1/" >internal</a><br>
<a class="space-page-content" href="http://www.google.com" >external</a><br>
<a class="space-page-content" href="http://www.mywebsite.com" >internal</a>
Upvotes: 1