The method of realizing IE hack using @media

Source: Internet
Author: User

As we all know, sometimes in order to achieve some of the effects of IE and modern browser consistent, we have to use some hack means to achieve the purpose. For example, using "\", "\" and "\9" to only allow certain versions of IE to be recognized, and for modern browsers, he will directly ignore the code. Today I want to introduce to you the method of implementing IE hack using @media:

Only IE6 and IE7 recognition

@media screen\9 {. selector {property:value;}}

Only IE6 and IE7, IE8 identification

@media \0screen\,screen\9 {. selector {property:value;}}

IE8 Identification only

@media \0screen {. selector {property:value;}}

IE8-10 Identification only

@media screen\0 {. selector {property:value;}}

Only IE9 and IE10 recognition

@media screen and (min-width:0\0) {. selector {property:value;}}

IE10 Identification only

@media screen and (-ms-high-contrast:active), (-ms-high-contrast:none) {/* Ie10-spe

Google support only

        @media screen and (-webkit-min-device-pixel-ratio:0) {

        .footer. layout-help {padding-bottom:357px;}  

}



above a few @media with "\", "" "and" \9 "can let different versions of IE recognition, then the specific project how do we use it?


body {  background: red;} /* ie6, IE7 into green  */@media  all\9 {  body {    background:  green;  }}/* ie8 into Blue  */@media  \0screen {  body {     BACKGROUND: BLUE;  }}/*IE9 and IE10 turn yellow */@media  screen and  ( min-width:0\0)  {  body {     background: yellow;    }} 



This article is from the "beautiful Dē‖java Question" blog, please be sure to keep this source http://teny32.blog.51cto.com/8027509/1772160

The method of realizing IE hack using @media

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.