CSS的IE6、IE7、FF兼容性写法
blue;< /td> | Firefox 背景变蓝色 |
red /9; | IE8 背景变红色 |
*black;< /td> | IE7 背景变黑色 |
_background:orange; | IE6 背景变橘色 |
#example { color: #333; } /* Moz */
* html #example { color: #666; } /*IE6 */
*+html #example { color: #999; } /* IE7 */
- color:red; /* 所有浏览器都支持 */
- color:red !important; /* 除IE6外 */
- _color:red; /* IE6支持 */
- *color:red; /* IE6、IE7支持 */
- +color:red; /*IE7支持*/
- *+color:red; /* IE7支持 */
- color:red\9; /* IE6、IE7、IE8、IE9支持 */
- color:red\; /* 针对所有IE */
- color:red\0; /* IE8、IE9支持 */
- color:red\9\0; /*IE9支持*/
- /* webkit and opera */
- @media all and (min-width: 0px){ div{color:red;} }
- /* webkit */
- @media screen and (-webkit-min-device-pixel-ratio:0){ div{color:red;} }
- /* opera */
- @media all and (-webkit-min-device-pixel-ratio:10000), not all and (-webkit-min-device-pixel-ratio:0) { div{color:red;} }
- /* firefox * /
- @-moz-document url-prefix(){ div{color:red;} } /* all firefox */
- html>/**/body div, x:-moz-any-link, x:default {color:red;} /* newest firefox */
- body:nth-of-type(1) p{color:red;} /* Chrome、Safari支持 */
- <!--[if lt IE 7 ]> <html class="ie6"> <![endif]-->
- <!--[if IE 7 ]> <html class="ie7"> <![endif]-->
- <!--[if IE 8 ]> <html class="ie8"> <![endif]-->
- <!--[if IE 9 ]> <html class="ie9"> <![endif]-->
- <!--[if (gt IE 9)|!(IE)]><!--> <html> <!--<![endif]-->
- <!-[if IE 7]> = 等于 IE7
- <!-[if lt IE 8]> = 小于 IE8(就是 IE7 或以下了啦)
- <!-[if gte IE 8]> = 大于或等于 IE8
- <meta http-equiv="x-ua-compatible" content="ie=7" />
- 把这段代码放到<head>里面,在ie8里面的页面解析起来就跟ie7一模一样的了
- <!-[if IE]>
- <link rel="stylesheet" href="/ie-all.css" type="text/css" media="screen" />
- <![endif]->
- <!-[if lt IE 8]>
- <link rel="stylesheet" href="/ie.css" type="text/css" media="screen" />
- <![endif]->
- <!-[if IE 7]>
- <link rel="stylesheet" href="/ie7.css" type="text/css" media="screen" />
- <![endif]->
- <!-[if IE 6]>
- <link rel="stylesheet" href="/ie6.css" type="text/css" media="screen" />
- <![endif]->
IE6以下
*html{}
IE 7 以下
*:first-child+html {} * html {}
只对IE 7
*:first-child+html {}
只对IE 7 和现代浏览器
html>body {}
只对IE 8(属性值后加/0)
.name {color:#ccc/0; }
只对现代浏览器(非IE 7)
html>/**/body {}
最新的Opera 9以下版本
html:first-child {}
Safari
html[xmlns*=”"] body:last-child {}
Firefox 3
.classname, x:-moz-any-link, x:default {}
#id, x:-moz-any-link, x:default {}
====================
所有浏览器下背景变灰(半透明)
body {filter:alpha(opacity=30);opacity:0.3;}
====================
区别IE6与FF:
background:orange;*blue;< /p>
区别IE6与IE7:
background:green !important;blue;< /p>
区别IE7与FF:
background:orange; *background:green;
区别FF,IE7,IE6:
background:orange;*background:green !important;*blue;< /p>
区别FF 3
“{”前加上“, x:-moz-any-link, x:default”,只有FF 3能识别
注:
IE都能识别*;标准浏览器(如FF)不能识别*;
IE6能识别*,但不能识别 !important,
IE7能识别*,也能识别!important;
只有IE8能识别/0
FF不能识别*,但能识别!important;
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?