css ie_media_queries_hack.css

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了css ie_media_queries_hack.css相关的知识,希望对你有一定的参考价值。

/*
* A combination of strategically placed \0, \, and \9 character escapes which IE will happily accept as valid syntax 
* causing it to parse the @media block and apply any style rules defined inside it. 
* Other browsers correctly identify the syntax error and discard the @media block along with its contents.
*/

/* To target IE 6 and 7 */
@media screen\9 {
    body { background: red; }
}

/* To target IE 6, 7 and 8 */
@media \0screen\,screen\9 {
    body { background: green; }
}

/* To target IE 8 */
@media \0screen {
    body { background: blue; }
}

/* To target IE 8, 9 and 10 */
@media screen\0 {
    body { background: orange; }
}

/* To target IE 9 and 10 */
@media screen and (min-width:0\0) {
    body { background: yellow; }
}

/* USING THE HACK */
body {
  background: pink;
}

/* IE 6 and 7 fallback styles */
@media all\9 {
    body {
        background: red;
    }
    h1 {
        color: yellow;
    }
}

/* IE 6 and 7 fallback print styles */
@media print\9 {
    body {
        color: blue;
    }
    h1 {
        color: red;
    }
}

/*
* Note that the @media type can be any of the supported types, so rules in @media screen\9 
* will target screens and @media print\9 will only apply to print style sheets.
*/

以上是关于css ie_media_queries_hack.css的主要内容,如果未能解决你的问题,请参考以下文章

如何在CSS中调用公用css

css [css:fadeout / fadein] css示例。 #css

css基础 CSS 组合选择符CSS 伪类CSS 伪元素

css 深度提示#css中的css base builder CSS

css基础 CSS 媒体类型CSS 属性 选择器CSS 表单CSS 计数器

什么是css