DIV+CSS教程_解决display:table-cell带来的莫名空白(irefox)
display:table-cell带来的莫名空白(firefox)?
在firefox下,
我把.main设置为display:table-cell;如果在.main内部添加浮动div,就会在该div下方莫名多出一些空白,请问怎么解决?
前提是.main必须设置为display:table-cell;
代码:
<style type="text/css">
.main{display:table-cell;*display:block;width:auto;}
.body,.main{*zoom:1;}
.body:after,.main:after{clear:both;display:block;visibility:hidden;overflow:hidden;height:0 !important;line-height:0;font-size:xx-large;content:" x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x ";}
.line:after,.lastUnit:after{content: " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ";visibility:hidden; clear:both;height:0 !important;display:block;line-height:0;font-size: xx-large;overflow: hidden;}
.line{*zoom:1;}
.fl{float:left;}
.main{background-color:tan}
.main div{background-color:lightblue}
</style>
<div class="line">
<div class="main">
<div>good</div>
</div>
</div>
<br/>
<br/>
<br/>
<div class="line">
<div class="main">
<div class="fl">good</div>
</div>
</div>
解决 设置填充就好了