各种浏览器css hack
2014-11-13 16:22
218 查看
你在写css时样式表加上浏览器标识符就行了,各浏览器区别如下:
IE都能识别*,标准浏览器(如FF)不能识别*;
IE6能识别*,但不能识别 !important;
IE7能识别*,也能识别 !important;
IE8能识别\0,不能识别*,+,_,*加!important;
FF不能识别*,但能识别 !important;
例如style=”*width:10px!important; width:20px;”
这样在IE6下宽度为10px,在IE7下宽度时20px
其中还有三种写法:
1种:
width:100px; /* FireFox及其他浏览器 */
width:200px\0; /* IE8能识别\0*/
*width:300px!important; /* ,IE7 既能能识别*号,也能识别important */
*width:400px; /* IE6也能识别*号 */
/*注意顺序 */
2种:
width:100px; /* FireFox及其他浏览器 */
width:200px\0; /* IE8能识别\0*/
*width:300px; /* IE7也能识别*号 */
_width:400px; /* IE6能识别下划线*/
/*注意顺序 */
3种:
width:100px; /* FireFox及其他浏览器 */
width:200px\0; /* IE8能识别\0*/
+width:300px; /* +只识别IE7 */
_width:400px; /* IE6能识别下划线*/
/*注意顺序 */
1..color1{ color:#F00; color/*\**/:#00F /*\**/}/*IE6,IE7,IE8,FF,OP,SA识别*/
2..color2{ color:#F00; color /*\**/:#00F /*\9**/}/*IE7,IE8,FF,OP,SA识别*/
3..color3{ color:#F00; color/*\**/:#00F \9}/*IE6,IE7,IE8识别*/
4..color4{ color:#F00; color /*\**/:#00F\9}/*IE7,IE8识别*//*“color”和“/*\**/”之间有个空格*/
其中:OP表示Opera,SA表示Safari
————————————-
各种浏览器独立支持的hack:
width:100px\0;/* 支持IE8 */
_width:100px; /* 支持IE6 */
[width:100px; /* 支持IE6,7 */
+width:100px; /* 支持IE6,7 */
*width:100px; /* 支持IE6,7 */
*width:100px!important; /* 支持IE6,7, */
*+width:100px; /* 支持IE6,7, */
*+width:100px!important;/* 支持IE6,7, */
width:100px\9; /* 支持IE6,7,8 */
width:100px!important; /* 支持IE6,7,8,FF */
w\idth:100px; /*IE5.x不支持 IE6、IE7、IE8、FF支持 */
------------------
IE条件注释功能:
<!--[if IE]>此内容只有IE可见<![endif]–>
<!–[if IE 6.0]>此内容只有IE6.0可见<![endif]–>
<!–[if IE 7.0]>此内容只有IE7.0可见<![endif]–>
IE都能识别*,标准浏览器(如FF)不能识别*;
IE6能识别*,但不能识别 !important;
IE7能识别*,也能识别 !important;
IE8能识别\0,不能识别*,+,_,*加!important;
FF不能识别*,但能识别 !important;
例如style=”*width:10px!important; width:20px;”
这样在IE6下宽度为10px,在IE7下宽度时20px
其中还有三种写法:
1种:
width:100px; /* FireFox及其他浏览器 */
width:200px\0; /* IE8能识别\0*/
*width:300px!important; /* ,IE7 既能能识别*号,也能识别important */
*width:400px; /* IE6也能识别*号 */
/*注意顺序 */
2种:
width:100px; /* FireFox及其他浏览器 */
width:200px\0; /* IE8能识别\0*/
*width:300px; /* IE7也能识别*号 */
_width:400px; /* IE6能识别下划线*/
/*注意顺序 */
3种:
width:100px; /* FireFox及其他浏览器 */
width:200px\0; /* IE8能识别\0*/
+width:300px; /* +只识别IE7 */
_width:400px; /* IE6能识别下划线*/
/*注意顺序 */
1..color1{ color:#F00; color/*\**/:#00F /*\**/}/*IE6,IE7,IE8,FF,OP,SA识别*/
2..color2{ color:#F00; color /*\**/:#00F /*\9**/}/*IE7,IE8,FF,OP,SA识别*/
3..color3{ color:#F00; color/*\**/:#00F \9}/*IE6,IE7,IE8识别*/
4..color4{ color:#F00; color /*\**/:#00F\9}/*IE7,IE8识别*//*“color”和“/*\**/”之间有个空格*/
其中:OP表示Opera,SA表示Safari
————————————-
各种浏览器独立支持的hack:
width:100px\0;/* 支持IE8 */
_width:100px; /* 支持IE6 */
[width:100px; /* 支持IE6,7 */
+width:100px; /* 支持IE6,7 */
*width:100px; /* 支持IE6,7 */
*width:100px!important; /* 支持IE6,7, */
*+width:100px; /* 支持IE6,7, */
*+width:100px!important;/* 支持IE6,7, */
width:100px\9; /* 支持IE6,7,8 */
width:100px!important; /* 支持IE6,7,8,FF */
w\idth:100px; /*IE5.x不支持 IE6、IE7、IE8、FF支持 */
------------------
IE条件注释功能:
<!--[if IE]>此内容只有IE可见<![endif]–>
<!–[if IE 6.0]>此内容只有IE6.0可见<![endif]–>
<!–[if IE 7.0]>此内容只有IE7.0可见<![endif]–>
相关文章推荐
- 各种浏览器中CSS hack的应用
- [转]针对各种浏览器的CSS Hack
- 浅谈各种浏览器下的CSS Hack兼容性写法
- [转]针对各种浏览器的CSS Hack
- 各种浏览器css hack
- 各种浏览器css hack
- 超级无敌各种浏览器css hack
- 【精华】CSS hack 各种浏览器的兼容一览表
- 一个兼容各种浏览器的层透明的css hack
- 各种浏览器CSS hack方法
- 各种浏览器css hack
- 各种浏览器CSS hack方法
- 浅谈各种浏览器下的CSS Hack兼容性写法
- 各种浏览器CSS hack方法与技巧收集
- 主流浏览器的一些CSS hack
- Loadrunner打不开浏览器以及卡死的各种问题
- Javascript、Jquery获取浏览器和屏幕各种高度宽度
- 各种浏览器内核的区别
- 各种浏览器的可见性