Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
IE7条件CSS注释不起作用_Css_Internet Explorer 7 - Fatal编程技术网

IE7条件CSS注释不起作用

IE7条件CSS注释不起作用,css,internet-explorer-7,Css,Internet Explorer 7,我的Windows7机器上安装了IE8,我正在使用开发人员工具以IE7浏览器模式显示页面 我想为IE7添加一个条件样式表,但它不起作用。路径是正确的,所以我猜,在这一点上,IE7浏览器模式实际上并没有完全呈现为IE7 <!--[if IE 7]> <link rel="stylesheet" type="text/css" href="http://example.com/media/IE7/ie_splash.css" />

我的Windows7机器上安装了IE8,我正在使用开发人员工具以IE7浏览器模式显示页面

我想为IE7添加一个条件样式表,但它不起作用。路径是正确的,所以我猜,在这一点上,IE7浏览器模式实际上并没有完全呈现为IE7

       <!--[if IE 7]>
           <link rel="stylesheet" type="text/css" href="http://example.com/media/IE7/ie_splash.css" />
       <![endif]-->


有什么想法或建议吗?

我已对Windows XP进行了快速检查,无法复制此内容-您可以尝试:

<html>
<body>

<!--[if IE 6]>
I am IE 6
<![endif]-->

<!--[if IE 7]>
I am IE 7
<![endif]-->

<!--[if IE 8]>
I am IE 8
<![endif]-->

</body>
</html>


并查看它在浏览器中呈现的版本。对我来说,切换到IE7会显示“我是IE7”。

我在Windows XP上做了一个快速检查,无法复制此功能-您可以尝试:

<html>
<body>

<!--[if IE 6]>
I am IE 6
<![endif]-->

<!--[if IE 7]>
I am IE 7
<![endif]-->

<!--[if IE 8]>
I am IE 8
<![endif]-->

</body>
</html>


并查看它在浏览器中呈现的版本。对我来说,切换到IE7会显示“我是IE7”。

我也遇到了这个问题,通过指定两个条件注释,我能够解决这个问题

首先,为IE7加载css文件的常用条件注释

<!--[if IE 7]>
           <link rel="stylesheet" type="text/css" href="http://example.com/media/IE7/ie_splash.css" />
<![endif]-->

其次,您需要为所有其他浏览器指定样式表!IE语法。因此,IE停止呈现您为其他浏览器准备的样式表

<!--[if !IE 7]><!-->
    <link rel="stylesheet" media="all" href="style.css" />
<!--<![endif]-->


这里style.css是您用于其他浏览器的原始样式表,您不希望IE使用它。

我也遇到了这个问题,通过指定两个条件注释,我能够解决这个问题

首先,为IE7加载css文件的常用条件注释

<!--[if IE 7]>
           <link rel="stylesheet" type="text/css" href="http://example.com/media/IE7/ie_splash.css" />
<![endif]-->

其次,您需要为所有其他浏览器指定样式表!IE语法。因此,IE停止呈现您为其他浏览器准备的样式表

<!--[if !IE 7]><!-->
    <link rel="stylesheet" media="all" href="style.css" />
<!--<![endif]-->


这里style.css是您用于其他浏览器的原始样式表,您不希望IE使用它。

确保您没有在兼容模式下显示。确保您没有在兼容模式下显示。这样做成功了,我解决了我的问题(真的是我自己的错)。谢谢奥利弗。这成功了,我发现了我的小毛病(其实是我自己的错)。谢谢你,奥利弗。