CONDITION CSS differentiate between IE6 to IE7(条件 CSS 区分 IE6 到 IE7)
问题描述
我想声明一个不同于 ie6 和 ie7 的样式,但我在 css 中的情况被 IE7 识别为 IE6.我使用 XP 和资源管理器 7.这是我使用的代码:
i want to declare a style different to ie6 and ie7 , but my condition in css recognized by IE7 as IE6. I use XP and explorer 7. This the code i use :
<!--[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]-->
我的错误是什么?
推荐答案
你不能在 CSS 中使用条件注释.仅在 HTML 中.因此,您必须将不同浏览器的声明放入不同的文件中,并对它们进行条件注释几个 <link>.
You can't use conditional comments in CSS. Only in HTML. So you'd have to put the declarations for the different browsers into different files and conditional-comment several <link>s to them.
更多类似的东西
<html>
<head>
<!--[if !IE]>
<link rel="stylesheet" type="text/css" href="style_non_ie.css">
<![endif]-->
...
</head>
</html>
这篇关于条件 CSS 区分 IE6 到 IE7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:条件 CSS 区分 IE6 到 IE7
基础教程推荐
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
