CSS 用于单元格填充

CSS for cell padding

我想使所有行的大小相同,但包含数据的行高很大。我想为空行修复此行大小。 Table class 名称是演示。 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>';
    }
   }
?>

为tr添加固定高度

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

检查 fiddle: http://jsfiddle.net/4gqgzdL8/1/

如果你需要 box-sizing 可以使用它否则不要使用

您需要在代码中添加以下内容CSS

.demo td{        
    height:20px;
}

Demo

尝试像这样设置 td 的高度和行高:Demo

.demo td {
 line-height:28px;
 height:28px;
}