无法覆盖用户代理样式着色我的链接 [英] Can't override user agent stylesheet coloring my links

查看:254
本文介绍了无法覆盖用户代理样式着色我的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个非常简单的网页,我希望超链接不要专色(原来不是蓝色,不是紫色的,不是访问的),也不是下划线的。



我之前在其他网站上完成了这个操作,而没有问题,只需使用

  a,a:visited,a:hover,a:active {
text-decoration:none;
颜色:无;
}

然而,在这个特定的网站中,而下划线已成功删除。我甚至尝试添加令人畏惧的!important 标记,但没有任何效果。



Chrome上出现过这个问题, IE 11和Android(WebView)。



当我使用Chrome浏览器的开发人员控制台检查链接时,它将拉动它的颜色特性:

  a: -  用户代理样式表 webkit-any-link {
color:-webkit-link;





$ b

所以我试着在我的样式表中明确地覆盖它,方法是加入 a:-webkit-any-link 添加到应用 color:none 属性的标签列表中,再次无效。我还在各种组合中添加了 a:any-link a:link ,无济于事。



对于我忽略的显而易见的解决方案的想法?

解决方案

color:none; 不是有效的css。



这应该是有效的:

  a,a:visited,a:hover,a:active {
text-decoration:none;
color:inherit;
}


It's always these simple problems that snag me.

I have a very simple page I'm building, and I want the hyperlinks to not be colored specially at all (not blue originally, not purple for visited) or underlined.

I've done this in other sites before without issue simply by using

a, a:visited, a:hover, a:active {
    text-decoration: none;
    color: none;
}

However, in this particular site, that's not doing the trick for the color, while the underline is successfully removed. I even tried adding the dreaded !important tag, with no effect.

This issue has been seen on Chrome, IE 11, and Android (WebView).

When I inspect the links using Chrome's Developer console, it's pulling its color attribute from the user agent stylesheet, specifically:

a:-webkit-any-link {
    color: -webkit-link;
}

So I tried overriding this explicitly in my stylesheet by adding a:-webkit-any-link to my list of tags to apply the color: none attribute to, again, to no effect. I also added a:any-link and a:link in various combinations, to no avail.

Thoughts on the obvious solution I'm overlooking?

解决方案

As the comments said color:none; is not valid css.

This should work:

a, a:visited, a:hover, a:active {
    text-decoration: none;
    color: inherit;
}

这篇关于无法覆盖用户代理样式着色我的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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