IE8 支持 CSS 媒体查询 [英] IE8 support for CSS Media Query

查看:28
本文介绍了IE8 支持 CSS 媒体查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

IE8 是否不支持以下 CSS 媒体查询:

Does IE8 not support the following CSS media query:

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

如果不是,另一种写作方式是什么?在 Firefox 中同样可以正常工作.

If not, what is the alternate way of writing? The same works fine in Firefox.

以下代码有问题吗?

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

推荐答案

IE9 之前的 Internet Explorer 版本不支持媒体查询.

Internet Explorer versions before IE9 do not support media queries.

如果您正在为 IE8 用户寻找一种降低设计的方法,您可能会发现 IE 的条件注释很有帮助.使用它,您可以指定一个 IE 8/7/6 特定样式表,它会覆盖之前的规则.

If you are looking for a way of degrading the design for IE8 users, you may find IE's conditional commenting helpful. Using this, you can specify an IE 8/7/6 specific style sheet which over writes the previous rules.

例如:

<link rel="stylesheet" type="text/css" media="all" href="style.css"/>
<!--[if lt IE 9]>
<link rel="stylesheet" type="text/css" media="all" href="style-ie.css"/>
<![endif]-->

这将不允许在 IE8 中进行响应式设计,但与使用 JS 插件相比,这可能是一种更简单、更易于访问的解决方案.

This won't allow for a responsive design in IE8, but could be a simpler and more accessible solution than using a JS plugin.

这篇关于IE8 支持 CSS 媒体查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆