【问题标题】:What is the browser default color for links? [duplicate]链接的浏览器默认颜色是什么? [复制]
【发布时间】:2020-11-28 14:04:50
【问题描述】:

我正在阅读 page 中有关使用通用值控制继承的内容。

如果浏览器默认的链接颜色是蓝色,我不明白为什么第三个链接是黑色的(对吗?)。

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        body {
            color: green;
        }

        .inherited a {
            color: inherit;
        }

        .reset a {
            color: initial;
        }

        .unset a {
            color: unset;
        }
    </style>
</head>

<body>

    <ul>
        <li>Default <a href="#">link</a> color</li>
        <li class="inherited">Inherit the <a href="#">link</a> color</li>
        <li class="reset">Reset the <a href="#">link</a> color</li>
        <li class="unset">Unset the <a href="#">link</a> color</li>
    </ul>

</body>

</html>

【问题讨论】:

    标签: css inheritance cascading


    【解决方案1】:

    链接的默认颜色是蓝色,但在这里您为“li”设置属性,“li”的初始颜色为黑色,这就是链接变成黑色的原因

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-06-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多