CSS区分ie8和FF的方法?

html-css023

CSS区分ie8和FF的方法?,第1张

IE8现在还没有很好的解决兼容性的办法,但是IE8有一个方式是可以降低到IE7版本浏览。就是在每个以完成的页面源码中添加这句话:<meta http-equiv="X-UA-Compatible" content="IE=7" />这样,我们做好的成品页面即使在IE8中测试不兼容,加上上面那段代码,就可以把IE8的兼容性视图降低至IE7,一切就正常啦!以下是css兼容IE6、IE7和FF的方法:区分IE6,IE7,firefox

区别不同浏览器,CSS hack写法:

区别IE6与FF:

background:orange*background:blue

区别IE6与IE7:

background:green !importantbackground:blue

区别IE7与FF:

background:orange*background:green

区别FF,IE7,IE6:

background:orange*background:green_background:blue

background:orange*background:green !important*background:blue

注:IE都能识别*标准浏览器(如FF)不能识别*;

IE6能识别*,但不能识别 !important,

IE7能识别*,也能识别!important

FF不能识别*,但能识别!important

区别FF,IE7,IE6: \x0d\x0abackground:green !importantbackground:orange*background:blue\x0d\x0a\x0d\x0aIE6能识别*,但不能识别 !important,\x0d\x0a\x0d\x0aIE7能识别*,也能识别!important\x0d\x0a\x0d\x0aFF不能识别*,但能识别!important\x0d\x0a\x0d\x0a另外再补充一个,下划线”_“,IE6支持下划线,IE7和firefox均不支持下划线。\x0d\x0a\x0d\x0a于是大家还可以这样来区分firefox,IE7,IE6 \x0d\x0abackground:green!important*background:orange_background:blue\x0d\x0a\x0d\x0a注:不管是什么方法,书写的顺序都是firefox的写在前面,IE7的写在中间,IE6的写在最后面。