asp.net - 将鼠标悬停在文本上时更改字体颜色

标签 asp.net html css webforms

我不太了解 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; 
}

另外,这里有一个关于伪类的引用,它应该为你解决这个问题。

http://www.w3schools.com/css/css_pseudo_classes.asp

关于asp.net - 将鼠标悬停在文本上时更改字体颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9826689/

相关文章:

asp.net - 设计一个 "Verified"用户状态

c# - 禁用图像按钮上的回发单击 asp

html - div 和 ul 中的中心图标列表

html - http和www的区别

javascript - 使用 `background:url()` 淡化横幅

asp.net - 如何在 ASP.NET Core (ASP.NET 5) 中创建自定义授权

asp.net - 如何创建youtube缩略图链接

javascript - 为什么第二次点击功能不起作用?

jquery - 使用 jquery 添加 css 规则

css - 更改插入符号图标