简体   繁体   中英

Stop browser from reading media queries

I'm building a responsive site, and as per usual IE7 is very difficult to accomodate. I was wondering if it is possible to switch off ALL media queries just for IE7, and still keep all the styling/layout as it is when in desktop mode?

Well, you don't need to switch of Media queries for IE7 because they are not supported in first place I believe.

The @media CSS code will get ignored.

I assume you are not using a polyfill for it though.

Source: https://developer.mozilla.org/en-US/docs/Web/CSS/@media#Browser_compatibility

You can make to different CSS files one for IE7 and another one for the other browsers. To select the stylesheet that fits to the user's browser use conditional comments in the "head" tag of your html file.

<!--[if IE 7]>
   <link rel="stylesheet" href="css/ie7.css">
<![endif]-->
<!--[if !(IE 7)]>
   <link rel="stylesheet" href="css/normal.css">
<![endif]>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM