gpt4 book ai didi

css - html 条件语句 hack 在实时时将 IE 视为错误版本

转载 作者:太空宇宙 更新时间:2023-11-04 16:12:12 25 4
gpt4 key购买 nike

基本上,我正在针对不同版本的 IE 优化网站。我正在使用 IE9(通过 IE 的关于页面验证)。

本地(使用 xampp)网站正确检测到浏览器是 IE9 并加载正确的 css 代码。但是,当我将代码放到文本服务器上时,它会将浏览器视为 IE7。

对于测试:

我使用 xmapp 在本地获得的输出

According to the conditional comment this is IE
According to the conditional comment this is IE 9
According to the conditional comment this is IE 8 or higher
According to the conditional comment this is IE greater than 6

我在测试服务器上得到的输出:

According to the conditional comment this is IE
According to the conditional comment this is IE 7
According to the conditional comment this is IE lower than 9
According to the conditional comment this is IE lower or equal to 7
According to the conditional comment this is IE greater than 6

关于问题可能是什么的任何想法?

编辑:我用来检查版本的内容

<!--[if IE]>
According to the conditional comment this is IE<br />
<![endif]-->
<!--[if IE 6]>
According to the conditional comment this is IE 6<br />
<![endif]-->
<!--[if IE 7]>
According to the conditional comment this is IE 7<br />
<![endif]-->
<!--[if IE 8]>
According to the conditional comment this is IE 8<br />
<![endif]-->
<!--[if IE 9]>
According to the conditional comment this is IE 9<br />
<![endif]-->
<!--[if gte IE 8]>
According to the conditional comment this is IE 8 or higher<br />
<![endif]-->
<!--[if lt IE 9]>
According to the conditional comment this is IE lower than 9<br />
<![endif]-->
<!--[if lte IE 7]>
According to the conditional comment this is IE lower or equal to 7<br />
<![endif]-->
<!--[if gt IE 6]>
According to the conditional comment this is IE greater than 6<br />
<![endif]-->
<!--[if !IE]> -->
According to the conditional comment this is not IE<br />
<!-- <![endif]-->

最佳答案

尝试将此元添加到您的头部部分:

<meta http-equiv="X-UA-Compatible" content="IE=Edge"/>

还有这个文档类型:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/DTD/strict.dtd">
<html>

关于css - html 条件语句 hack 在实时时将 IE 视为错误版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8187346/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com