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


- addEventListener 在 IE 11 中不起作用 2022-01-01
- Fetch API 如何获取响应体? 2022-01-01
- 400或500级别的HTTP响应 2022-01-01
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- 失败的 Canvas 360 jquery 插件 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06