css – 什么时候“a”标签不会继承父标签的颜色属性?

前端之家收集整理的这篇文章主要介绍了css – 什么时候“a”标签不会继承父标签的颜色属性?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
这是我的代码
css部分
.blue {
    color:#6E99E1;
    font-size:9px;
}

标记部分

<span class="blue">::<a href="/equipment_new.PHP">CLICK HERE</a>:: to view our New Equipment inventory. <br /><br /></span>

我以某种方式触发了阻止“一个”标签继承父标签颜色(这里是“span”)的东西。

解决方法

默认情况下,如果存在href属性,则锚标签不会继承属性,如颜色。

看看这两个在一个页面上的差异(我不怎么让它显示在帖子上):

<span style=color:green><a href="t">test</a></span>


<span style=color:green><a>test</a></span>

以下链接到w3 c:

http://www.w3.org/TR/html401/struct/links.html#h-12.2

User agents generally render links in
such a way as to make them obvIoUs to
users (underlining,reverse video,
etc.). The exact rendering depends on
the user agent. Rendering may vary
according to whether the user has
already visited the link or not.

…..

Usually,the contents of A are not rendered in any special way when A defines an anchor only.

原文链接:https://www.f2er.com/css/218573.html

猜你在找的CSS相关文章