Does IE8 not support the following CSS media query:
@import url("desktop.css") screen and (min-width: 768px);
If not, what is the alternate way of writing? The same works fine in Firefox.
Any issues with the code below?
@import url("desktop.css") screen;
@import url("ipad.css") only screen and (device-width:768px);
Taken from the css3mediaqueries.js project page.
Note: Doesn't work on @import'ed stylesheets (which you shouldn't use anyway for performance reasons). Also won't listen to the media attribute of the
<link>
and<style>
elements.An easy way to use the css3-mediaqueries-js is to include the following before the closing body tag:
http://blog.keithclark.co.uk/wp-content/uploads/2012/11/ie-media-block-tests.php
I used
@media \0screen {}
and it works fine for me in REAL IE8.The best solution I've found is Respond.js especially if your main concern is making sure your responsive design works in IE8. It's pretty lightweight at 1kb when min/gzipped and you can make sure only IE8 clients load it:
It's also the recommended method if you're using bootstrap: http://getbootstrap.com/getting-started/#support-ie8-ie9
Edited answer: IE understands just screen and print as import media. All other CSS supplied along with the import statement causes IE8 to ignore the import statement. Geco browser like safari or mozilla didn't have this problem.