我想要的是我希望这部分 html 代码对 IE6 和 IE7 隐藏,但对 Firefox、Opera 或 IE8 不隐藏,但是条件注释在这部分不能正常工作....我正在使用单独的 CSS 和条件注释在 head 部分但是 opera 的条件注释不起作用,有时 Firefox 会显示奇怪的行为
<!--[if gte IE 8]>
<[if Gecko]>
<div class="anythingSlider">
<div class="wrapper">
<ul>
<li>
<img src="gallery/1.jpg" alt="" />
</li>
<li>
<img src="gallery/2.jpg" alt="" />
</li>
</ul>
</div>
</div>
<[endif]>
<[endif]––>
最佳答案
没有这样的东西:
<[if Gecko]>
条件注释只对IE有效,所以你只能区分IE5、IE6、IE7、IE8和[所有其他浏览器]。 (幸运的是,通常只有 IE6,也许您需要嗅探 IE7!)
i want this portion of html code to be hidden from IE6 and IE7
好的,要不仅在测试条件下而且在 [所有其他浏览器] 上显示条件注释的内容,您需要 downlevel-revealed conditional comment :
<!--[if gte IE 8]><!-->
<div class="anythingSlider">
...
</div>
<!--<![endif]-->
(请注意,这不是下层显示的 CC 的官方 MS 语法,因为那将是无效的 HTML。)
关于css - 从多个浏览器中隐藏 HTML 部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1636282/