【发布时间】:2021-02-05 15:52:18
【问题描述】:
超链接的初始颜色是蓝色,即访问选择器的颜色。但是背景颜色是黑色的,即链接选择器的颜色。此外,访问链接一次后,文本颜色保持应有的蓝色,但背景不会变为透明。
这是样式代码:<style>
a:link {
color: pink;
background-color: black;
text-decoration: none;
}
a:visited {
color: blue;
background-color: transparent;
text-decoration: none;
}
a:hover {
color: red;
background-color: transparent;
text-decoration: underline;
}
a:active {
color: yellow;
background-color: transparent;
text-decoration: underline;
}
</style>
</head>
<body>
<h2>Link Colors</h2>
<a href="html_images.asp" target="_self">HTML Images</a>
</body>
</html>
我无法理解链接选择器的行为。为什么格式不明确,并且从两个不同且独占的选择器中得到随机混合输出?
【问题讨论】: