问题描述:

I want to make all the rows in the same size.But rows height with data is large.I want to fix this row size for empty rows.Table class name is demo.

Demo

<?php

while($fet=mysql_fetch_assoc($sql1))

{

$id=$fet['c_id'];

$address=$fet['address'];

$chk=$fet["c_name"];

$in=$in+1;

echo "<tr>";

echo "<td style='align:center'><a class='astext' href='client_view.php?cid=".$fet["c_id"]."'>".$fet["c_name"]."</a></td>";

echo "<td style='align:center'><a class='ima' href='client_details.php?cid=".$fet["c_id"]."'><img src='image/edit1.png' alt='edit' style='width:20px; height:20px' title=Edit></a></td><td style='align:center'>

<a class='ima' href='clients.php?del=".$fet["c_id"]."'><img src='image/delete1.png' alt='delete' style='width:20px;height:20px' title=Delete></a></td>";

echo "</tr>";

}

if ($in < 10) {

$empty_rows = 10 - mysql_num_rows($sql1);

for ($m = 0; $m < $empty_rows; $m++) {

echo '<tr><td></td><td></td><td></td></tr>';

}

}

?>

网友答案:

You need to add following CSS in your code.

.demo td{        
    height:20px;
}

Demo

网友答案:

Add fixed height to tr like

table tr {
height: 40px;
box-sizing: border-box;
}

check fiddle: http://jsfiddle.net/4gqgzdL8/1/

If you need box-sizing you can use it otherwise don't use

网友答案:

Try to set height and line-height for td like this: Demo

.demo td {
 line-height:28px;
 height:28px;
}
相关阅读:
Top