簡體   English   中英

表格使用div單元格高度問題(帶角度)

[英]table using div cell height issue (with angular)

我桌上的單元格高度有問題。 我嘗試將最小高度為115px的工作用於某些數量的語言,但是如果超過該值會破壞單元格。 無論單元中有多少種語言,我都需要擴展該單元。

.comparison-table .lang{
  min-height: 115px;
  height: 100%/auto;
  padding: 15px;
}

在此處輸入圖片說明

根據上面的要求。

即使我不同意,這是如何為每個對象的第一行添加一個類。 然后讓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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM