I have the following HTML
<div class = "left">
<div id = "links">
<a href = "none" style = "text-decoration: none"><b>About</b></a>
<br>
<a href = "none" style = "text-decoration: none"><b>Principals</b></a>
<br>
<a href = "none" style = "text-decoration: none"><b>Contact</b></a>
<br>
</div>
</div>
以及CSS
.left {
position: fixed;
top: 0px;
left: 0px;
width: 30%;
height: 100%;
background-color: #8EE5EE;
color: #000000;
}
#links {
position: relative;
top: 40%;
text-align: right;
font-family: "Verdana", "Arial Black", sans-serif;
font-size: 25px;
color: #000000;
}
我的链接颜色应该是黑色,但它们显示为深蓝色。这段代码有什么问题吗?
在此处查看JSFiddle。
谢谢!
#links
标识的是div而不是div内部的链接(<a>
)标签。通过改变颜色,你只是改变了div内文本的颜色,而不是锚点文本的颜色。下面的众多答案之一可以为您提供正确的解决方案。 - War10ck