2014-01-23 61 views
1

是否可以修复jsFiddle纯css以便同一行中的所有3个div具有相同的高度,其最多3个heitghts ?css:将浮动div的高度设置为其高度的最大值

的代码是在这里:

<style> 
#main{ 
    border:1px solid red; 
    width:605px; 
    overflow:hidden; 
} 
#zero{ 
    border:1px solid blue; 
} 
.small{ 
    border:1px solid green; 
    float:left; 
    width:199px; 
} 
</style> 
<div id="main"> 
    <div id="zero"> 
     0 
    </div> 
    <div class="small"> 
     small text 
    </div> 
    <div class="small"> 
     large text large textlarge textlarge textlarge textlarge textlarge textlarge textlarge textlarge textlarge textlarge textlarge text 
    </div> 
    <div class="small"> 
     another small text 
    </div> 
</div> 

同样,纯CSS溶液是优选的。如果没有,那么HTML解决方案是最好的下一步。 Javascript(/ jQuery)解决方案不是必需的。 谢谢。

回答

1

您可以用display:table-cell取代float:left

EXAMPLE HERE

.small { 
    border:1px solid green; 
    display:table-cell; 
    width:199px; 
} 
相关问题