简体   繁体   English

针对 Internet Explorer 6 中响应式设计的小屏幕

[英]target small screens for responsive design in internet explorer 6

this is something different.这是不同的东西。 I need to create a web page for IE 6 using css2 and vanilla js.我需要使用 css2 和 vanilla js 为 IE 6 创建一个网页。 the problem is that I cant target smeller screens in IE6 so my design getting broken in screen smaller than 1000px.问题是我无法在 IE6 中定位嗅觉屏幕,所以我的设计在小于 1000px 的屏幕上被破坏。

in chrome and other modern browsers, I'm using media query and its working perfectly.在 chrome 和其他现代浏览器中,我正在使用媒体查询并且它工作得很好。

I have read about several hacks.我已经阅读了几个黑客。 but the CSS always apply to all the screen sizes and not to smaller ones但 CSS 始终适用于所有屏幕尺寸,而不适用于较小的屏幕尺寸

HTML: HTML:

 <link rel="stylesheet" href="css/main.css">
    <!--[if IE]>
        <link rel="stylesheet" href="css/ie.css" />
    <![endif]-->

ie.css:即.css:

   body {
       background: red;
   }

   @media screen and (min-width: 640px),
   screen\9 {
       body {
           background: green;
       }
   }

how can I make it change only in smaller screens我怎样才能让它只在较小的屏幕上改变

Quite already answered there media queries internet explorer已经在那里回答了媒体查询 Internet Explorer

IE6... is old. IE6...是旧的。 So I would use javascript for resize event, and if the window width is smaller than 1000px, I would add a specific class to the body所以我会使用javascript进行resize事件,如果窗口宽度小于1000px,我会向body添加一个特定的类

Then, your CSS will be responsive by using the new class added to body, instead of media queries..然后,您的 CSS 将通过使用添加到 body 的新类而不是媒体查询来响应。

Something like就像是

/* Standard style */
body{background: red;}
.a-class{color: black;}

/* Responsive style */
body.resp-class{background: green;}
body.resp-class .a-class{color: red;}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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