CSS区分ie8和FF的方法?

html-css015

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

input[type="text']{background-color:yellow}

单引号和双引号不可同时使用,应该为:

input[type="text“]{background-color:yellow}