我不太了解css,但我有点卡住了。我想在悬停时将字体的颜色更改为浅蓝色。但是,我希望默认颜色为白色...我该怎么做?我现在拥有的,已将默认文本更改为紫色..并加下划线:S它确实将字体更改为蓝色,但悬停在..
代码:
CSS:
a:hover
{
text-decoration:none;
color: #B9D3EE;
}
.navigationBar
{
background: gray;
height: 50px;
width: 100%;
}
.menuOption
{
width:143px;
text-align: center;
position: static;
float:left;
}
#search
{
position:relative;
font-weight: bold;
color: white;
height: 27px;
margin-left: 23px;
left: 133px;
top: -17px;
margin-top: 1px;
}
#reports
{
position:relative;
font-weight: bold;
color: white;
height: 27px;
margin-left: 23px;
left: 34px;
top: -16px;
margin-top: 1px;
}
#addProject
{
position:relative;
font-weight: bold;
color: #B9D3EE;
height: 27px;
margin-left: 23px;
left: -542px;
top: -18px;
margin-top: 1px;
}
#editProject
{
position:relative;
font-weight: bold;
color: white;
height: 27px;
margin-left: 23px;
left: -611px;
top: -18px;
margin-top: 1px;
}
#more
{
position:relative;
font-weight: bold;
color: white;
height: 27px;
margin-left: 23px;
left: -66px;
top: -15px;
margin-top: 1px;
}
HTML:
<div class = "navigationBar">
<asp:ImageButton ID="ImageButton1" runat="server" Height="18px"
ImageUrl="~/g.png" style="margin-left: 1012px; margin-top: 18px"
Width="23px" />
<div id = "search" class = "menuOption" >
<a href=""> Search </a>
</div>
<div id = "reports" class = "menuOption" >
<a href=""> Reports </a>
</div>
<div id = "more" class = "menuOption" >
<a href=""> More... </a>
</div>
<div id = "addProject" class = "menuOption" >
<a href=""> Add Project </a>
</div>
<div id = "editProject" class = "menuOption" >
<a href=""> Edit Project </a>
</div>
</div>
答案 0 :(得分:5)
a:link
{
text-decoration:none;
color: #B9D3EE;
}
a:visited
{
text-decoration:none;
color: #B9D3EE;
}
a:hover
{
text-decoration:none;
color: #B9D3EE;
}
a:active
{
text-decoration:none;
color: #B9D3EE;
}
另外,这里是伪类的参考,应该为你清除这一点。
答案 1 :(得分:2)
与@Brett Wait相似,但更简洁
a{
text-decoration:none;
color:#FFF;
}
a:hover
{
text-decoration:none;
color: #B9D3EE;
}
它之所以是紫色的,是因为默认情况下超链接是蓝色的,但是当它们被访问时,则变为紫色。在您的情况下,“”的网址基本上是当前页面,这是访问。 :)
编辑删除不需要的伪类:h / t @yunzen