html - 悬停在 IE 8 中不起作用

标签 html css internet-explorer-8

悬停在 IE8 中不起作用,它会在悬停时划掉文本。

这是代码。

HTML

<div class="divCls">
    <span class="textColor">Contacts</span>
</div>

CSS

.divCls:hover{
    background-color:#E8F7F9 !important;
    padding-top: 5px;
    padding-bottom: 5px;
}

最佳答案

在 IE8 中,如果您在 quirks 模式下运行,:hover仅支持 <a>元素(<div> 不是)。

确保您有一个可以触发标准模式的 Doctype。

参见 the Wikipedia article on Quirks mode进一步阅读。

关于html - 悬停在 IE 8 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10516857/

相关文章:

javascript - 将 javascript 代码内的文本 attr 更改为 "readonly false"

javascript - 如何在收到获取请求后重新加载 CSS 或按钮或页面的一部分?

css - 如何使用CSS媒体查询内联标签?

css - 为什么我必须添加 "overflow:hidden"才能使导航栏在页面上可见?

javascript - 阻止 <enter> 在 IE8 中的文件输入上提交表单

javascript - IE 不会将 css 样式应用于动态添加的 div

javascript - 使用 jQuery 设置 <option> 元素的文本

html - 简单的骰子滚动效果 - CSS 动画

html - 使用带有背景图片的替代文本?

html - Box Shadow 在 Internet Explorer 8 中不起作用?