CSS区分ie8和FF的方法?

html-css010

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

“\9″  只在IE6/IE7/IE8/IE9/IE10下生效

“\0”  只在 IE8/IE9/IE10下生效

“\9\0”只在IE9/IE10下生效

selector{

color:#000

color:#F00\0 /* only for IE8&IE9&IE10 */

color:#000\9\0/* only for IE9&IE10 */

}