2010-06-09 26 views
1

我想东部和西部div向下延伸以匹配中心div的高度...可能吗?Equal Column Heights

非常感谢。

.con{ 
padding-left: 22px; 
padding-right: 22px; 
overflow: hidden; 
} 

.col{ 
position: relative; 
float: left; 
} 

.west{ 
width: 7px; 
right: 22px; 
margin-left: -100%; 
background: url(http://www.example.com/west.png) repeat-y; 
padding: 0 0 0 15; 
} 

.east{ 
width: 7px; 
margin-right: -22px; 
background: url(http://www.example.com/east.png) repeat-y; 
padding: 0 15 0 0; 
} 

.center{ 
width: 100%; 
} 


<div class="con"> 
    <div class="center col"> 
    Test Text<br/> 
    Test Text<br/> 
    Test Text<br/> 
    Test Text<br/> 
    </div> 
    <div class="west col"> 
</div> 
<div class="east col"> 
</div> 
</div> 
+0

这看起来是http://stackoverflow.com/questions/1780325/both-columns-same-height-as-deepest-column的副本 – 2010-06-09 13:37:20

回答

0

我用这个jQuery的解决方案,它为别人寻找伟大工程......

var maxHeight = 0; 
$(".col").each(function(){ 
    maxHeight = $(this).height() > maxHeight ? $(this).height() : maxHeight; 
}).height(maxHeight);​ 

仅供参考。试图给它的寿。