![](/img/trans.png)
[英]How to set height of empty div inside table cell to height of that cell
[英]table using div cell height issue (with angular)
根据上面的要求。
即使我不同意,这是如何为每个对象的第一行添加一个类。 然后让JS找出最高的。 然后将它们全部设置为该高度。
HTML
<div class="test" style="height:40px; width:20px; background-color:red;"></div>
<div class="test" style="height:60px; width:20px; background-color:blue;"></div>
<div class="test" style="height:80px; width:20px; background-color:green;"></div>
<div class="test" style="height:90px; width:20px; background-color:yellow;"></div>
JS
var maxHeight = 0;
$( ".test" ).each(function( index ) {
if ( $( this ).height() > maxHeight ){
maxHeight = $( this ).height();
}
});
$('.test').css({"height": maxHeight});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.