CSS a href样式 [英] CSS a href styling
本文介绍了CSS a href样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个href与 class =button
.button a:link {text-decoration:none}
.button a:visited {text-decoration: none}
.button a:active {text-decoration:none}
.button a:hover {text-decoration:none;背景颜色:黄色;颜色:蓝色}
为什么它不工作?
如何为该类设置href( class =button
)
解决方案
.button a
是一个后代选择器。它匹配 .button
的后代的所有< a>
p>
您需要编写 a.button:link
才能匹配标记< a> ;
和 .button
。
i have a href with class="button"
I am trying to style this like that:
.button a:link {text-decoration: none}
.button a:visited {text-decoration: none}
.button a:active {text-decoration: none}
.button a:hover {text-decoration: none; background-color:yellow;color:blue}
why it is not working?
how to set stye for a href with that class (class="button"
)
解决方案
.button a
is a descendant selector. It matches all <a>
tags that are descendants of .button
.
You need to write a.button:link
to match tags that are both <a>
and .button
.
这篇关于CSS a href样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文