a:hover not working(答:悬停不工作)
问题描述
HTML
<table width="100%">
<tr>
<td width="90%"></td>
<td><a href="#" id="logout"><strong>Logout</strong></a></td>
</tr>
</table>
CSS
@charset "utf-8";
/* CSS Document */
#logout {
color:#BBB;
}
a:hover {
color:#FFF;
}
虽然注销的颜色似乎是 css 中给出的颜色,但当我将鼠标放在链接 (to white) 上时颜色不会改变.是什么原因?
Though the color of logout appears to be what is given in the css , the color doesn't change when i place my mouse over the link (to white) . What is the reason ?
我必须说还有其他 css 文件,当鼠标放在它们上面时,它们往往会改变链接的颜色并且它们工作正常.
I must tell there are other css files that tend to change the color of the link when the mouse is placed over them and they work fine.
推荐答案
id 选择器 (#logout
) 比类型选择器 (a
) 加一个伪类 (:hover
),因此您的第一个规则集将始终 赢得级联.
An id selector (#logout
) is more specific then a type selector (a
) plus a pseudo-class (:hover
), so your first ruleset will always win the cascade.
使用 #logout:hover
代替.
这篇关于答:悬停不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:答:悬停不工作


- 使用 iframe URL 的 jQuery UI 对话框 2022-01-01
- 如何向 ipc 渲染器发送添加回调 2022-01-01
- 为什么我的页面无法在 Github 上加载? 2022-01-01
- 如何调试 CSS/Javascript 悬停问题 2022-01-01
- 是否可以将标志传递给 Gulp 以使其以不同的方式 2022-01-01
- 如何显示带有换行符的文本标签? 2022-01-01
- 在不使用循环的情况下查找数字数组中的一项 2022-01-01
- 我不能使用 json 使用 react 向我的 web api 发出 Post 请求 2022-01-01
- 为什么悬停在委托事件处理程序中不起作用? 2022-01-01
- 从原点悬停时触发 translateY() 2022-01-01