【问题标题】:How to write CSS media query , that should applicable only for IE9 and IE 10?如何编写仅适用于 IE9 和 IE 10 的 CSS 媒体查询?
【发布时间】:2016-09-28 23:03:01
【问题描述】:

目前我使用的 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 中找到的媒体查询,但它们不起作用。除了媒体查询还有其他写法吗?

【问题讨论】:

  • 你可以把它放到一个单独的css文件中,然后使用IE的条件cmets,<!--[if IE9] --><link href="ie9stuff.css" /><![endif]-->

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


【解决方案1】:

这里描述的方法应该适用于 IE10 及更高版本,不再支持条件 cmets:

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

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

【讨论】:

    【解决方案2】:

    尝试使用 IE 条件语句...

    <!--[if gte IE 6]>
        <link rel="stylesheet" type="text/css" href="ie6-and-up.css" />
    <![endif]-->    
    

    这可能有用..

    https://css-tricks.com/how-to-create-an-ie-only-stylesheet/

    【讨论】:

    • IE10+ 不支持条件 cmets
    猜你喜欢
    • 2019-01-21
    • 2011-11-09
    • 2014-12-16
    • 1970-01-01
    • 2011-12-29
    • 1970-01-01
    • 1970-01-01
    • 2015-03-08
    • 1970-01-01
    相关资源
    最近更新 更多