respond.js polyfill not working for last media query in IE8

微笑、不失礼 提交于 2019-12-23 18:30:53

问题


I have two media queries in my css (not counting the print one) : @media screen and (min-width: 720px) {} and @media screen and (min-width: 1026px) {

I am using respond.js to get them to behave under IE8. The weird thing is that it works perfectly, except for the last media query where it reverts back to the css before the media queries. I.e., it works well until the window hits that 1026px threshold in width.

Anybody got an idea as to what is going on there ? Here is the link to the preview : http://bit.ly/i6ITPe

Thanks a bunch for any answer


回答1:


I have been having several issues with this and have found it working on and off again. First off based on the forums I have been reading you should not include respond.js from modernizr, they are more than likely going to drop it. Also when you include respond.js add it after all of your stylesheets. It should be one of the last things to load. Hope that helps! =)




回答2:


There are a few things to bere in mind when using respond.js

  1. It needs to parse the css by making an ajax call to the stylesheet in a link element
  2. It cant understand dynamically created CSS from eg client side LESS , or styles injected via document.write, jQuery etc,.
  3. @Import statements are not followed inside stylesheets

Hope this helps.




回答3:


I'm not sure if this applies to you, but I just found an issue that breaks the css while using respond.js.

do you have any elements that open and close with no styles i.e:

ul.demo{}

I found this was breaking my css in ie 8 and below



来源:https://stackoverflow.com/questions/8245452/respond-js-polyfill-not-working-for-last-media-query-in-ie8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!