CSS: Style external links

前端 未结 8 1824
甜味超标
甜味超标 2021-01-30 16:55

I want to style all external links in my website (Wordpress). I\'m trying with:

.post p a[href^=\"http://\"]:after

But Wordpress put the entire

8条回答
  •  天涯浪人
    2021-01-30 17:51

    I combined @superlogical + @Shaz to make something for my Foundation WP theme...

    a[href^="http://"]:not([href*="maggew.com"]):after {
         content: " " url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAVklEQVR4Xn3PgQkAMQhDUXfqTu7kTtkpd5RA8AInfArtQ2iRXFWT2QedAfttj2FsPIOE1eCOlEuoWWjgzYaB/IkeGOrxXhqB+uA9Bfcm0lAZuh+YIeAD+cAqSz4kCMUAAAAASUVORK5CYII=);    
    }
    

    You can use this HTML snippet to test on your site:

    External
    

    This is a working example, look above to change the color to monochrome



    This is what I used for a custom image (like a favicon)

    a[href^="http://"]:not([href*="magew.com"]):after {
         content: " " url('/wp-content/uploads/2014/03/favicon.png');    
    }
    

    This is a working example, look for the favicon - see it?

提交回复
热议问题