本文主要是介绍css中兼容各個IE版本,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
IE6,IE7,IE8,Firefox兼容的css hack补充: color{background-color: #CC00FF; /*所有浏览器都会显示为紫色*/background-color: #FF0000\9; /*IE6、IE7、IE8会显示红色*/*background-color: #0066FF; /*IE6、IE7会变为蓝色*/ _background-color: #009933; /*IE6会变为绿色*/ } 好多css hack,最重要的是简单实用能解决问题就行了 总结: \9: IE6 IE7 IE8 *: IE6 IE7 _: IE6 *+: IE7 ---------------------------------------- IE6,IE7,Firefox兼容的css hack 第一种办法: body {background:red;*background:blue !important; *background: green; }第一排给Firefox以及其他浏览器看; 第二排给IE7,IE7既能能识别*号,也能识别important; 第三排给IE6也能识别*号; 第二种办法,使用_来区分IE6:body {background:red;*background:blue; _background: green; }第一排给Firefox以及其他浏览器看; 第二排给IE7,IE7既能能识别*号; 第三排给IE6能识别下划线;
IE8的兼容,就是在value後面家\9然後再";",如:
.inq-result-container { font-size: 13px; position: relative; display: inline-block; display: inherit\9; /* IE8 */ *display: inherit; /* IE6 IE7 */ zoom: 1; /**display: inline;*/ }
那麼IE9及後面的版本呢?看這些詳細的語法:
IE 6, 7 and 8
@media \0screen\,screen\9 {.ie678 {property:value;} }
IE 8
html>/**/body .ie8 {property:value;}
or
@media \0screen {.ie8 {property:value;} }
IE 8 Standards Mode Only
.ie8 { property /*\**/: value\9 }
IE 8,9 and 10
@media screen\0 {.ie8910 {property:value;} }
IE 9 only
@media screen and (min-width:0\0) and (min-resolution: .001dpcm) { // IE9 CSS.ie9{property:value;} }
IE 9 and above
@media screen and (min-width:0\0) and (min-resolution: +72dpi) {// IE9+ CSS.ie9up{property:value;} }
IE 9 and 10
@media screen and (min-width:0\0) {.ie910{property:value\9;} /* backslash-9 removes ie11+ & old Safari 4 */ }
IE 10 only
_:-ms-lang(x), .ie10 { property:value\9; }
IE 10 and above
_:-ms-lang(x), .ie10up { property:value; }
or
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {.ie10up{property:value;} }
IE 11 (and above..)
_:-ms-fullscreen, :root .ie11up { property:value; }
这篇关于css中兼容各個IE版本的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!