如何在悬停时停止链接更改颜色?

时间:2014-05-28 09:26:35

标签: html css

我的页面上有一个电子邮件链接,当它悬停时会变成蓝色。

我似乎无法解决这个问题,我根本不想改变它。在它的CSS中我把它作为:

.emaillink2
{   text-decoration: none;
color: white;}

a.hover:hover
{   text-decoration: none;
color: white;}

#headerinfo
{
float: right;
font-size: 32px;
color: white;
z-index: 1;
text-align: right;
margin-top: 20px;
text-decoration: none;
}

div的HTML:

<div id="headerinfo">
Telephone: 07777777777
<br/>
Fax: 07777777777
<br/>
Email: <a href="mailto:info@website.org" class="emaillink2">Info@website.org</a>
</div>

然而,当它盘旋时仍会改变颜色。

3 个答案:

答案 0 :(得分:10)

更改此代码:

.emaillink2
{   text-decoration: none;
color: white;}

到此代码:

.emaillink2, .emaillink2:hover
{   text-decoration: none;
color: white;}

答案 1 :(得分:4)

而不是这个

a.hover:hover
{   
  text-decoration: none;
  color: white;
}

像这样使用。

a:hover
{   
  text-decoration: none;
  color: white;
}

答案 2 :(得分:0)

假设你有不同颜色的“a”标签,你可能想在这种情况下尝试这个 -

a:hover{
    text-decoration: none;
    color: inherit;
}