浏览器兼容性技巧

1div垂直居中:设置line-height:height的高度;vertical-align:middle;(内容不可换行)

2margin加倍:设置了floatdiv里面再添加一个displayonline(浮动ie产生双倍距离的情况也可以这么解决)

3iemin-无效:

添加一句:width: expression(document.body.clientWidth < 760? 760px100%” );

4div浮动ie文本产生3pxbug(外div左浮动,里面第一个div左浮动,第二个div跟第一个有3px的空隙)

#right{margin-right:-3px;}

5】设置背景居中且内部左浮动排列列表,则嵌套一个#bg

<div><div  id=“bg” style=float:left;width:100%..................</div></div>

6】内层元素发生变化,外层不自动调节大小(2种方法),则

1)外层添加border属性

2)内层上下各添加一个.divclass{height:0px;overflow:hidden;} 

7ie6下图片有空隙

1)displayblock

2)vertical-aligntop/bottom/middle

3)改变html排版

8】对齐文本与文本输入框

input中添加vertical-alignmiddle

9li中内容超过长度以... ...显示

 li { 
  width:200px; 
  white-space:nowrap; 
  text-overflow:ellipsis; 
  -o-text-overflow:ellipsis; 
  overflow: hidden; 
  }

10ie中设置滚动条颜色

html { 
  scrollbar-face-color:#f6f6f6; 
  scrollbar-highlight-color:#fff; 
  scrollbar-shadow-color:#eeeeee; 
  scrollbar-3dlight-color:#eeeeee; 
  scrollbar-arrow-color:#000; 
  scrollbar-track-color:#fff; 
  scrollbar-darkshadow-color:#fff; 
  

11ie6中已经默认宽高,则

1zoom0.08

2line-height1px

3overflowhidden

12】整个页面居中显示

ie6中设置bodytext-align:center;

而在ff  chmargin0 auto

13a标签加样式,需要添加display:block

14ulie中默认有margin,在ff默认有padding

    所以先设置formul{margin:0;padding:0;}(在ieform会有margin

15ff会对!important优先解析,而ie不会

16ie6中图片3px问题

1DIV加上:font-size: 0px;

2)设置imgdisplay:block;

17ie6导致行距无效

对和文字相连接的imginputtextareaselectobject等元素加以属性 margin: (所属line-height-自身高度)/2px 0

18ie6使用滤镜对png图片设置为透明,结果链接无效

则:为a设置一个positionrelative

 

posted @ 2013-07-15 15:04  小女子意  阅读(161)  评论(0编辑  收藏  举报