![](/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.