0

2つの隣接するdivに2つのテーブルがあります。最初のテーブルのtr(テーブル行)の高さが2番目のテーブルの高さと一致しません。両方のテーブルのtr(テーブル行)の高さを同じにしたいのですが、左のテーブルのtr(テーブル行)の高さに応じて、2番目(右)のテーブルのtr(テーブル行)の高さを設定/調整するにはどうすればよいですか?plzヘルプ..それは異なる解像度で動作するはずです..

4

2 に答える 2

0

jQuery の使用:

$tableheight2 = $('#table2').height();
$tableheight = $('#table1').height();


if($tableheight >= $tableheight2)
{

$('#table2').height(($tableheight);

}else{

$('#table1').height($tableheight2);

}

trで作る:

$trheight = 0;

/* loop all tr in function */
$('#table1 tr').each(function() {

  /* replace $strheight with tr height when smaller */ 
  if($(this).height()>$strheight){
    $strheight=$(this).height();
  }
}

/* loop all tr and replace the height with $strheight */
$('#table1 tr').each(function() {
   $(this).height($strheight);
}
于 2012-06-13T08:07:11.917 に答える
0

またはCSSを使用して、固定の高さに:

<style>
    table tr {
        height: 50px;
    }
</style>
于 2012-06-13T08:13:05.757 に答える