【发布时间】: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