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
基础教程推荐
- 在 contenteditable 中精确拖放 2022-01-01
- fetch 是否支持原生多文件上传? 2022-01-01
- Fabric JS绘制具有活动形状的多边形 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01
- 如何添加到目前为止的天数? 2022-01-01
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
- npm start 错误与 create-react-app 2022-01-01
- Bokeh Div文本对齐 2022-01-01
- 检查 HTML5 拖放文件类型 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01
