Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何阻止链接在悬停时更改颜色?_Html_Css - Fatal编程技术网

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

Html 如何阻止链接在悬停时更改颜色?,html,css,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;

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

我似乎无法解决这个问题,我根本不想让它改变。在它的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>

电话:07777

传真:07777
电邮:
但是,当鼠标悬停在上方时,它仍然会改变颜色。

而不是此按钮

a.hover:hover
{   
  text-decoration: none;
  color: white;
}
像这样使用

a:hover
{   
  text-decoration: none;
  color: white;
}
更改此代码:

.emaillink2
{   text-decoration: none;
color: white;}
.emaillink2, .emaillink2:hover
{   text-decoration: none;
color: white;}
根据本守则:

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

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

a:悬停{
文字装饰:无;
颜色:继承;

}
在JSFIDLE上提供最简单的示例,该示例再现了您的问题。是否将
.hover
类实际添加到锚点??您的hover属性在css中没有正确定义,请将a.hover:hover{..}更改为a:hover{..}不确定为什么,但这对我不起作用,我本来是这样的,但是a.hover:hover是在另一个线程中建议的。是的,因为提供的答案将设置文档中所有锚的样式,但是如果添加a.hover:hover,它将仅设置带有的锚元素的样式。hover classBrilliant,修复了它,非常感谢!(9分钟内不能勾选答案,但我会一次勾选:)为什么要两次包含“文本装饰:无”?这在第一句话中似乎是多余的。