CSS:样式外部链接 [英] CSS: Style external links

查看:162
本文介绍了CSS:样式外部链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的网站(Wordpress)中设置所有外部链接的样式。我尝试使用:

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

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

但Wordpress把整个网址链接...所以,我怎么样式所有的链接, http://www.mywebsite.com

But Wordpress put the entire url in the links... So, how could I style all links that doesn't start with http://www.mywebsite.com ?

谢谢。 / p>

Thank you.

推荐答案

使用一些特殊的CSS语法,你可以轻松地做到这一点。以下是适用于HTTP和HTTPS协议的一种方法:

Using some special CSS syntax you can easily do this. Here is one way that should work for both the HTTP and HTTPS protocols:

a[href^="http://"]:not([href*="example.com"]):after,
a[href^="https://"]:not([href*="example.com"]):after{
    content: " (EXTERNAL)" 
}

请点击此处

这篇关于CSS:样式外部链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆