Home > Web Front-end > CSS Tutorial > Does IE8 Support Modern CSS Media Queries?

Does IE8 Support Modern CSS Media Queries?

Susan Sarandon
Release: 2024-12-18 14:51:09
Original
198 people have browsed it

Does IE8 Support Modern CSS Media Queries?

IE8 Compatible CSS Media Query

Question: Does IE8 not support the following CSS media query?

@import url("desktop.css") screen and (min-width: 768px);
Copy after login

Answer: IE8 does not support the given media query. An alternative way of writing it that is compatible with IE8 is:

@import url("desktop.css") screen;
@import url("ipad.css") only screen and (device-width:768px);
Copy after login

Note: This updated code uses nested @import statements. However, @import can impact performance and is not recommended for production use. Consider using a media query polyfill instead.

CSS3 Media Queries Polyfills:

To support media queries in IE8 and older browsers, you can use JavaScript polyfills like:

  • css3-mediaqueries-js: Emulates media queries but doesn't work on imported stylesheets.
  • Respond.js: Enables min-width and max-width media queries only.

The above is the detailed content of Does IE8 Support Modern CSS Media Queries?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template