CSS中区分IE6,IE7,Firefox三大浏览器

开发 前端
本文向大家描述一下CSS在IE6,IE7,Firefox几点区分,不过不管是什么方法,书写的顺序都是Firefox的写在前面,IE7的写在中间,IE6的写在最后面。

你对在CSS中区分IE6,IE7,Firefox三大浏览器的方法是否了解,这里和大家分享一下,希望对你的学习有所帮助。

CSS在IE6,IE7,Firefox几点区分

◆区别IE6与Firefox:

background:orange;*background:blue;

◆区别IE6与IE7:

background:green!important;background:blue;

◆区别IE7与Firefox:

background:orange;*background:green;

◆区别Firefox,IE7,IE6:

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

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

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

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

Firefox不能识别*,但能识别!important;

                                IE6                  IE7          Firefox       
                   *              √                  √                ×

               !important   ×                 √                 √

另外再补充一个,下划线"_",IE6支持下划线,IE7和Firefox均不支持下划线。

于是大家还可以这样来区分IE6,IE7,Firefox
:background:orange;*background:green;_background:blue;

注:不管是什么方法,书写的顺序都是Firefox的写在前面,IE7的写在中间,IE6的写在***面。

示例代码: 

  1. .p_redirect{  
  2. background-color:#FirefoxFirefoxFirefox;  
  3. border:1pxsolid#A3C2E0;  
  4. margin-right:1px;  
  5. font-size:12px!important;  
  6. font-size:13px;  
  7. }  

是为了兼容IE/Firefox使用如下代码: 

  1. font-size:12px!important;  
  2. font-size:13px;  

在IE里面,由于IE不理解!important,则字体大小按照***设定的13px展示,而Firefox里面,!important为提高优先级别,则字体大小按照!important标记的12px展示

【编辑推荐】

  1. 探究IE7beta2的CSS兼容性
  2. IE6、IE7、Firefox中margin问题解决办法
  3. 探究IE8与IE7实现共存的两种方法
  4. CSS兼容:解决IE6、IE7和IE8的兼容问题妙招
  5. 将XHTML+CSS页面转换为打印机页面技巧
责任编辑:佚名 来源: div-css.net
相关推荐

2010-08-19 16:38:33

IE6IE7Firefox

2010-08-18 14:21:48

FirefoxIE7IE6

2010-09-06 15:06:29

IE6IE7Firefox

2010-08-20 13:08:41

IE6IE7IE8

2010-08-20 08:45:55

IE6IE7IE8

2010-09-15 10:19:12

IE6IE7IE8

2010-08-18 14:54:32

IE6IE7Firefox

2010-08-18 14:42:16

IE6IE7IE8

2010-08-18 15:22:28

IE6IE7Firefox

2010-08-27 15:44:47

2010-09-16 13:17:31

IE6IE7IE8

2010-09-15 11:32:37

IE6IE7浏览器兼容性

2010-09-15 11:18:27

IE6IE7火狐

2010-08-17 16:27:52

IE6IE7IE8

2010-08-27 15:38:21

兼容IE6IE7

2010-08-30 09:35:35

IE6IE7Firefox

2010-08-18 15:57:14

IE6IE7IE8

2010-09-16 13:33:47

IE6IE7IE8

2010-09-15 10:57:25

IE6IE7FF

2010-08-27 15:08:10

FirefoxIE6IE7
点赞
收藏

51CTO技术栈公众号