CSS - 基于其“rel”类型的链接。属性? [英] CSS - style a link based on its "rel" attribute?
本文介绍了CSS - 基于其“rel”类型的链接。属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<a href="http://google.com" rel="external"> LINK </a>
是否可以为rel =external添加css规则?
is it possible to add css rules for rel="external" ?
推荐答案
Felix Kling和三十点建议使用 [att = val]
属性选择器$ c> a [rel =external] )。 但只有在 external
是 rel
值。
Felix Kling and thirtydot suggested to use the [att=val]
attribute selector (a[rel="external"]
). But this will only work if external
is the only rel
value.
如果您想要为可能有一个或多个 rel
值的链接设置样式,则应使用 [att〜= val]
属性选择器:
If you want to style links that could have 1 or more rel
values, you should use the [att~=val]
attribute selector:
a [rel〜=external]
(请注意波形字符)
此类链接的示例可以是:
An example for such a link could be:
<a href="http://google.com" rel="external nofollow">LINK</a>
请参阅 http://www.w3.org/TR/css3-selectors/#attribute-representation 了解规格。
这篇关于CSS - 基于其“rel”类型的链接。属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文