我有一个页面,我需要显示基于IE版本的帮助文本。我已经决定按照this blog使用条件注释。我的html页面是这样的.
<!DOCTYPE html>
<html>
<head>
<title>Application Title</title>
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
</head>
<!--[if lt IE 9 ]><body style="margin: 0px;" class="ie9lt"><![endif]-->
<!--[if IE]> <body style="margin: 0px;" class="ie9"> <![endif]-->
<!--[if (gt IE 10)|!(IE)]>-->
<body style="margin: 0px;"><!--<![endif]-->
<div id="id1">
....
....
</html>我在ie9上打开了这个文件,但是通过检查elements选项检查了html,但是我的body元素没有与之关联的ie9类(就此而言,没有任何类)。我是不是漏掉了什么?请帮帮忙
发布于 2013-01-18 05:31:36
我用IE9检查过你的超文本标记语言,它工作得很好。我可以看到body有ie9类。
你能在下面的HTML检查器中看到同样的东西吗?另外,您的浏览器模式是否设置为IE9?

有时,当你的超文本标记语言文档中有错误时,IE会自动切换到兼容性视图模式,然后你的body类就是ie9lt (而不是ie9)。
发布于 2013-05-27 21:00:18
您可以尝试更具体地处理根HTML标记:
<!doctype html>
<!--[if IE 7 ]><html lang="en" class="ie7"><![endif]-->
<!--[if IE 8 ]><html lang="en" class="ie8"><![endif]-->
<!--[if IE 9 ]><html lang="en" class="ie9"><![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<html lang="en">
<!--<![endif]-->发布于 2013-01-18 05:26:27
我只在这些评论中添加了样式定义,没有其他内容。让html文档尽可能保持干净。这可能是该黑客最混乱的实现之一。
https://stackoverflow.com/questions/14388361
复制相似问题