常见的浏览器兼容性问题总结

1. 不同浏览器的标签默认外补丁margin和内补丁padding不同

发生概率:100%

解决方案:使用CSS通配符*,设置内外补丁为0

*{ margin: 0; padding: 0;}

2.  块属性标签float之后,又有横向的margin值,在IE6中显示会比设置的大(IE6双边距bug)

  发生概率:90%

   解决方案:在float标签样式控制中加入display:inline;

3. 设置较小的高度标签(一般小于10px),在IE6,IE7,遨游中超出自己设置的高度

发生概率:60%

解决方案:给超出高度的标签设置overflow:hidden;或者设置行高line-height小于你设置的高度。

4. 行内标签设置display:block;后又采用float布局,再设置横向margin值时,在IE6中显示会比设置的大(IE6双边距bug)

发生概率:20%

解决方案:在display:block;后面加上display:inline;display:table;

5. 图片默认有间距

发生概率:20%

解决方案:使用float为img布局

6. 标签最低高度设置min-height不兼容

发生概率:5%

解决方案:例如要设置一个标签的最小高度为200px

{ min-height: 200px;

 height: auto!important;

height: 200px;

overflow: visible;}

7. 透明度兼容设置

发生概率:主要看你要写的东西设不设透明度

解决方案:一句话

transparent_class {   

    filter:alpha(opacity=50);   

       -moz-opacity:0.5;   

       -khtml-opacity: 0.5;   

       opacity: 0.5;   

 } 

opacity:0.5; This is the “most important” one because it is the currentstandard in CSS. This will work in most versions of Firefox, Safari, andOpera.This would be all you need if all browsers supported current standards. Which,of course, they don’t.

filter:alpha(opacity=50); This one you need for IE.

-moz-opacity:0.5; You need this one to support way old school versions of theMozilla browsers like Netscape Navigator.

-khtml-opacity:0.5; This is for way old versions of Safari (1.x) when therendering engine it was using was still referred to as KTHML, asopposed to thecurrent WebKit .

 

8. Box Model的bug

描述:给一个元素设置了高度和宽度的同时,还为其设置margin和padding的值,会改变该元素的实际大小。

解决办法:在需要加 margin和padding的div内部加一个div,在这个div里设置margin和padding值。

9. IE6中的列表li楼梯状bug

描述:通常在li中的元素(比如a)设置了浮动float,但li本身不浮动。

解决办法:

ul li{float:left;}

或 ul li{display:inline;}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值