本文介绍了从链接中删除蓝色下划线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图让链接以白色显示,没有下划线.文本颜色正确显示为白色,但蓝色下划线顽固地存在.我在 CSS 中尝试了 text-decoration: none;
和 text-decoration: none !important;
来删除链接下划线.都没有工作.
.boxhead .otherPage {颜色:#FFFFFF;文字装饰:无;}
<h2><span class="thisPage">当前页面</span><a href="myLink"><span class="otherPage">不同页面</span></a>
如何去除链接中的蓝色下划线?
解决方案
您不是将 text-decoration: none;
应用到锚点 (.boxhead a
) 而是到 span 元素 (.boxhead
).
试试这个:
.boxhead a {颜色:#FFFFFF;文字装饰:无;}
I am attempting to have a link show up in white, without an underline. The text color shows up correctly as white, but the blue underline is stubbornly persisting. I tried text-decoration: none;
and text-decoration: none !important;
in the CSS to remove the link underline. Neither worked.
.boxhead .otherPage {
color: #FFFFFF;
text-decoration: none;
}
<div class="boxhead">
<h2>
<span class="thisPage">Current Page</span>
<a href="myLink"><span class="otherPage">Different Page</span></a>
</h2>
</div>
How can I remove the blue underline from the link?
解决方案
You are not applying text-decoration: none;
to an anchor (.boxhead a
) but to a span element (.boxhead
).
Try this:
.boxhead a {
color: #FFFFFF;
text-decoration: none;
}
这篇关于从链接中删除蓝色下划线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!