【发布时间】:2010-11-10 02:07:00
【问题描述】:
我想声明一个不同于 ie6 和 ie7 的样式, 但我在 css 中的情况被 IE7 识别为 IE6。我使用 XP 和资源管理器 7。 这是我使用的代码:
<!--[if !IE]>
#mainDiv{text-align:-moz-center;}
#skyBanner {top:0px;left:0px; position:fixed;visibility:hidden;}
<![endif]-->
<!--[if lt IE 7]>
body > #skyBanner { position: fixed;}
#skyBanner {position:absolute;visibility:hidden;
left: expression( ( 0 + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
top: expression( ( 0 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
}
<![endif]-->
<!--[if IE 7]>
#skyBanner {position:fixed;visibility:hidden;
}
<![endif]-->
我的错误是什么?
【问题讨论】:
-
条件 cmets 只有 IE 支持。因此只有 IE 可以看到
<!--[if !IE]>。 IE 看到的内容被告知忽略。
标签: html css internet-explorer-6 internet-explorer-7 conditional