您现在的位置是:网站首页> 编程资料编程资料

IE 元素默认高度研究_CSS教程_CSS_网页制作_

2021-09-08 825人已围观

简介 你可以用IETester 和多个浏览器查看DEMO进行比较

序号HTMLIE<=7 CSS样式表现: 实际高度 (px)说明
1
0啥事没有
2
width:100px;
15触发haslayout
3
height:1px;
0
4
overflow:hidden;
15触发haslayout
 
5
width:100px; height:0px;
0
6
width:100px; line-height:0px
15
7
width:100px; font-size:0;
2
8
width:100px; height:0px; line-height:0px;
0
9
width:100px; height:0px; font-size:0;
0
10
width:100px; height:0px; overflow:hidden;
0成功
11
width:100px; line-height:0px; overflow:hidden
15
12
width:100px; font-size:0px; overflow:hidden
2


总结:

  1. 如果你需要从0开始自适应高度,那么不要定义width/height/overflow
  2. 如果你要定义小于15像素的高度,加上 overflow:hidden; 就可以了

演示地址: http://demo.jb51.net/html/IE-default-height.html

-六神源码网