css - 如何编写 CSS 媒体查询,应该只适用于 IE9 和 IE 10?

标签 css internet-explorer internet-explorer-9 internet-explorer-10

目前我使用的 CSS 类是:

body.srp-map-view {
  .page-content {
    position: absolute;
    top: 49px; 
    right: 0;
    left: 0;
    bottom: 0;
    overflow-x: hidden;
  }
}

如果是 IE 9 或 IE 10 我必须添加 margin-top: 29px;属性给上面的类。

我尝试了一些我在 stackoverflow 中找到的媒体查询,但它们不起作用。除了媒体查询,还有其他写法吗?

最佳答案

此处描述的方法应该适用于 IE10 及更高版本,不再支持条件注释:

https://css-tricks.com/ie-10-specific-styles/

正如文章所说,如果可能的话,最好使用特征检测而不是浏览器检测。

关于css - 如何编写 CSS 媒体查询,应该只适用于 IE9 和 IE 10?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39750084/

相关文章:

html - 向 img 标签添加不透明的背景色

html - 示例中的上边距/下边距不适用于左/右边距

javascript - 如何使用 .on click 事件以 4 个按钮作为触发器更改图像

javascript - IE7+ 的复选框/单选框样式

html - 看不到任何背景图像 - 在 IE 7 和 IE 8 中

javascript - Windows 更新后 ActiveX ListControl 事件不再起作用

html - 我的想法哪里错了?浏览器缩放简单的 <div> 框

页面刷新时 Javascript 内存泄漏;补救?

html - IE9 : <ul> and rtl 上的奇怪错误

javascript - SVG、jQuery 和 Internet Explorer