css - 如何在 IE 7 中禁用样式但允许其他样式

标签 css internet-explorer internet-explorer-7

我有风格

.sm:hover{border-bottom: 3px solid; 
border-color: #cc181e;
padding-bottom: 0;
display: inline-block;}

这在现代浏览器中看起来不错,但在 ie 7 中却不是(闪烁)

我正在尝试覆盖 IE7 中的样式。

<!--[if lt IE 9]>
   <link rel="stylesheet" type="text/css" href="css/ie7Style.css" />
 <![endif]-->

使用这种风格

.sm:hover{border-bottom: 0px; padding-bottom: 0; display: inline-block;}

但它还在闪烁。 如何禁用此闪烁或如何禁用此样式?

请不要因为网站显示在 TWebbrowser 组件中而让我不使用 IE 7。

最佳答案

您正在更改悬停时的显示属性。 尝试将 display:inline-block 应用于 .sm 类,然后添加悬停样式。

.sm {
  display: inline-block;
  *display: inline; /* IE7 fix */
  zoom: 1; /* IE7 fix */
}

.sm:hover {
  border-bottom: 3px solid; 
  border-color: #cc181e;
  padding-bottom: 0;
}

您还可以使用媒体查询技巧针对 IE7 及以下版本:

@media screen\9 { /* styles for IE6 and IE7 only */ }

关于css - 如何在 IE 7 中禁用样式但允许其他样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33584760/

相关文章:

javascript - 为什么 IE7 javascript array.indexOf 不工作?

cross-browser - Chrome 开发人员工具用户代理覆盖在模拟其他浏览器方面的效果如何?

css - 将 font-size CSS 属性设置为 'vh' 值是不好的做法吗?

javascript - 使用 Javascript/JQuery 更改 CSS 链接属性 onClick?

jquery - 为什么我的粘性导航不起作用?

html - 右键单击 anchor 未在 IE 中显示预期的上下文菜单

windows - IIS:对不在域中的客户端计算机使用 Kerberos

我网站上的 HTML 字幕文本移动速度怪异,但在 Chrome 中查看时,它完全没问题吗?

javascript - Internet Explorer、Json.Net JavaScript 日期和毫秒问题

css - 如何在两行中对齐图像 avec 文本,这在 IE7 中有效?