+ -
当前位置:首页 → 问答吧 → TD没有内容时不显示边框~

TD没有内容时不显示边框~

时间:2011-01-22

来源:互联网


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> <style> TABLE.colorTest{ border-top: 1px solid #68a3c2; border-left: 1px solid #68a3c2; border-right: 0px; border-bottom: 0px; } .colorTest TD{ border-top: 1px solid white; border-left: 1px solid white; border-right: 1px solid #68a3c2; border-bottom: 1px solid #68a3c2; } </style> </head> <body style="background:#dbe4fa;"> <table class="colorTest" cellpadding="1" cellspacing="0" border="1" width="80%"> <tbody> <tr > <td height="50"></td> </tr> <tr> <td> 第二行 </td> </tr> </tbody> </table> </body> </html>
 提示:您可以先修改部分代码再运行
求教各位,除了在table标签里面加border-collapse:collapse,以外还有没有别的办法使TD没有内容时显示边框~因为加了这个属性2边线条合在一起了,立体感就没了。当然还有占位符也可以。

[ 本帖最后由 lidewu 于 2011-1-22 11:14 编辑 ]

作者: lidewu   发布时间: 2011-01-22

单元格内没有内容的话,就输出一个 &nbsp; 吧。

作者: birdstudio   发布时间: 2011-01-23