(!IE) 阻止 IE 代码的问题
我(再次)增强了学校网站的模板。但是,我遇到了另一个问题。我注意到导航栏在 IE9 之前的任何 Internet Explorer 版本中都无法正确呈现(这是预料之中的)。我在网络上看到了 !IE 标签的使用,并尝试在我的设计中复制它。然而,一旦实施,每个浏览器都会停止显示该代码段。
<!--[if !IE]>
<li><p> </p></li>
<li><img src="vp-global-logo.gif" />
<![endif]-->
我也尝试过:
<!--[if gte IE 9]>
<li><p> </p></li>
<li><img src="vp-global-logo.gif" />
<![endif]-->
我该如何让它发挥作用?有没有其他方法而不会使网站太慢?
I have (once again) been enhancing my template for a school site. However, I have run into another problem. I have noticed that the navigation bar does not render properly in any Internet Explorer version prior to IE9 (to be expected). I had seen the use of the !IE tag around the web and tried replicating it on my design. However, once implemented, every browser stopped showing that piece of code.
<!--[if !IE]>
<li><p> </p></li>
<li><img src="vp-global-logo.gif" />
<![endif]-->
I also tried:
<!--[if gte IE 9]>
<li><p> </p></li>
<li><img src="vp-global-logo.gif" />
<![endif]-->
How would I get this to work? Is there any alternative method without making the site too slow?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要使用特殊语法终止条件注释:
这可以防止 IE 在其他浏览器看到 HTML 时显示它,并将 if 和 else 视为常规 HTML 注释。
You need to terminate the conditional comments with a special syntax:
This prevents IE from displaying the HTML while other browsers get to see it, treating the if and else as regular HTML comments.
您正在注释掉列表项,请尝试将代码更改为:
You're commenting out the list items, try changing your code to this: