0

我只想为 IE7 提供较低的媒体查询(因为我不想修复所有较高的布局),但我无法使用条件标签来处理它。难道我做错了什么?

我使用了 respond.js (https://github.com/scottjehl/Respond),所以应该没问题,但是条件标签会阻止所有浏览器加载更高级别的媒体查询。

应该发生的是所有浏览器都应该加载所有媒体查询,而 IE7 及以下版本应该只加载我的 601.css 和 768.css 样式表

<link rel="stylesheet" type="text/css" media="all" href="http://www.example.com/style.css" />
<link rel="stylesheet" href="http://www.example.com/mq/601.css" type="text/css"  media="(min-width: 601px)"/>
<link rel="stylesheet" href="http://www.example.com/mq/768.css" type="text/css"  media="(min-width: 768px)"/>   

<!--[if gt IE 7]>
    <link rel="stylesheet" href="http://www.example.com/mq/1024.css" type="text/css"  media="(min-width: 1024px)"/>
    <link rel="stylesheet" href="http://www.example.com/mq/1280.css" type="text/css"  media="(min-width: 1280px)"/> 
    <link rel="stylesheet" href="http://www.example.com/mq/1600.css" type="text/css"  media="(min-width: 1600px)"/>
<![endif]-->
4

1 回答 1

0

对,明白了。gt IE 7 似乎只包括所有 IE 向上。相反,我们还需要包括不是 IE 的浏览器。

所以...

<!--[if (gt IE 7)|!(IE)]><!-->
    <link rel="stylesheet" href="http://www.example.com/mq/1024.css" type="text/css"  media="(min-width: 1024px)"/>
    <link rel="stylesheet" href="http://www.example.com/mq/1280.css" type="text/css"  media="(min-width: 1280px)"/> 
    <link rel="stylesheet" href="http://www.example.com/mq/1600.css" type="text/css"  media="(min-width: 1600px)"/>
<![endif]-->
于 2012-06-24T17:01:50.533 回答