我不太了解 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>
最佳答案
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;
}
另外,这里有一个关于伪类的引用,它应该为你解决这个问题。
关于asp.net - 将鼠标悬停在文本上时更改字体颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9826689/