【问题标题】:CSS target internet explorer & screen widthCSS 目标 Internet Explorer 和屏幕宽度
【发布时间】:2017-01-12 21:08:12
【问题描述】:

我正在尝试为 Internet Explorer 添加自定义样式,但对于不同的屏幕尺寸,它需要有所不同。 只针对 IE 我正在使用它。

@media screen\0, screen\9 {
    .site-logo{
        max-width: 150px;
    }
}

然后添加浏览器宽度我试过了,但它不起作用:

@media screen\0 and (min-width: 59.6875em){
    .site-logo{
        max-width: 300px;
    }
}

这可能很容易,但我想不通...提前谢谢

【问题讨论】:

    标签: html css internet-explorer media-queries


    【解决方案1】:

    您可以改用属性 IE hacks

    @media screen and (max-width: 59.6875em) {
      .site-logo {
        color: red\9; /* IE6, IE7, IE8, IE9 */
        /* or this */
        color: red\0; /* IE8, IE9 */
        /* or this */
        color: red\9\0; /*Only works in IE9*/
        /* every browsers */
        color: red
      }
    }
    <div class="site-logo">text</div>

    出于演示目的将min 更改为max

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-28
      • 2012-11-01
      • 1970-01-01
      • 2018-12-28
      相关资源
      最近更新 更多