在输出表格的时候,没有内容的项输出后没有表格边框,不知道怎么回事啊?
代码:<?php
$sqlstr = "select id,name,lot_number,r_data,supplier,custos,deal_name,comment from ruku";
$result = mysql_query($sqlstr,$conn);
while($rows = mysql_fetch_row($result)){
?>
<tr >
<td height="20" align="center" valign="middle" class="table1"><?php echo $rows[0]; ?></td>
<td height="20" align="center" valign="middle" class="table1"><?php echo $rows[1]; ?></td>
<td height="20" align="center" valign="middle" class="table1"><?php echo $rows[2]; ?></td>
<td height="20" align="center" valign="middle" class="table1"><?php echo $rows[3]; ?></td>
<td height="20" align="center" valign="middle" class="table1"><?php echo $rows[4]; ?></td>
<td height="20" align="center" valign="middle" class="table1"><?php echo $rows[5]; ?></td>
<td height="20" align="center" valign="middle" class="table1"><?php echo $rows[6]; ?></td>
<td height="20" align="center" valign="middle" class="table1"><?php echo $rows[7]; ?></td>
<td align="center" valign="middle" class="table1"><a href="modify_staf.php?id=<?php echo $rows[0]; ?>">修改</a>/<a href="del_staf_chk.php?id=<?php echo $rows[0]; ?>" onclick="return del_chk();">删除</a></td>
</tr>
效果如下图
代码:<?php
$sqlstr = "select id,name,lot_number,r_data,supplier,custos,deal_name,comment from ruku";
$result = mysql_query($sqlstr,$conn);
while($rows = mysql_fetch_row($result)){
?>
<tr >
<td height="20" align="center" valign="middle" class="table1"><?php echo $rows[0]; ?></td>
<td height="20" align="center" valign="middle" class="table1"><?php echo $rows[1]; ?></td>
<td height="20" align="center" valign="middle" class="table1"><?php echo $rows[2]; ?></td>
<td height="20" align="center" valign="middle" class="table1"><?php echo $rows[3]; ?></td>
<td height="20" align="center" valign="middle" class="table1"><?php echo $rows[4]; ?></td>
<td height="20" align="center" valign="middle" class="table1"><?php echo $rows[5]; ?></td>
<td height="20" align="center" valign="middle" class="table1"><?php echo $rows[6]; ?></td>
<td height="20" align="center" valign="middle" class="table1"><?php echo $rows[7]; ?></td>
<td align="center" valign="middle" class="table1"><a href="modify_staf.php?id=<?php echo $rows[0]; ?>">修改</a>/<a href="del_staf_chk.php?id=<?php echo $rows[0]; ?>" onclick="return del_chk();">删除</a></td>
</tr>
效果如下图
.table2 td, .table1 tr{ border: 1px solid #9CBED6;
FONT-SIZE:14px;
text-align:center;
word-break:keep-all; /* 不换行 */
white-space:nowrap;/* 不换行 */
overflow:hidden;/* 内容超出宽度时隐藏超出部分的内容 */
text-overflow:ellipsis;/* 当对象内文本溢出时显示省略标记(...) ;需与overflow:hidden;一起使用。*/
}
<?php
$sqlstr = "select id,name,lot_number,r_data,supplier,custos,deal_name,comment from ruku";
$result = mysql_query($sqlstr,$conn);
while($rows = mysql_fetch_row($result)){
?>
<tr >
<td height="20" align="center" valign="middle" class="table1"><?php echo $rows[0]; ?> </td>
<td height="20" align="center" valign="middle" class="table1"><?php echo $rows[1]; ?> </td>
<td height="20" align="center" valign="middle" class="table1"><?php echo $rows[2]; ?> </td>
<td height="20" align="center" valign="middle" class="table1"><?php echo $rows[3]; ?> </td>
<td height="20" align="center" valign="middle" class="table1"><?php echo $rows[4]; ?> </td>
<td height="20" align="center" valign="middle" class="table1"><?php echo $rows[5]; ?> </td>
<td height="20" align="center" valign="middle" class="table1"><?php echo $rows[6]; ?> </td>
<td height="20" align="center" valign="middle" class="table1"><?php echo $rows[7]; ?> </td>
<td align="center" valign="middle" class="table1"><a href="modify_staf.php?id=<?php echo $rows[0]; ?>">修改</a>/<a href="del_staf_chk.php?id=<?php echo $rows[0]; ?>" onclick="return del_chk();">删除</a></td>
</tr>这样子,绝对可以。
HTML的表格要求要求有数据,空必须输入 ,否则就会出现你遇到的情况。
5楼是所有的td内都加
2楼是判断内容为空的加 2、也许通过特殊css定义td边框,能避免这种情况。