+ -
当前位置:首页 → 问答吧 → 如何画一个带边框的表格?

如何画一个带边框的表格?

时间:2011-04-18

来源:互联网

画一个单元格都有边框的表格,应该怎么写?

附件

未命名1111.jpg (53.3 KB)

2011-4-18 22:40

作者: Pratof   发布时间: 2011-04-18


<!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 {border-collapse: collapse;border-spacing: 0;width:250px;margin:10px auto;} td{ border:#333 solid 1px;} *{margin:0;padding:0;} </style> </head> <body> <table> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td colspan="3">&nbsp;</td> </tr> </table> </body> </html>
 提示:您可以先修改部分代码再运行
相应表格不同边框色 不同背景色 你可以通过命名统一的class进行设置
如果表格数据过多  可以通过js来控制相关表格

作者: businessDiv   发布时间: 2011-04-19


<!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=gb2312" /> <title>无标题文档</title> <style> *{ margin:0; padding:0;} body{ font-size:12px;} table{border-collapse:collapse; border-left:none; margin:100px auto 0; width:600px;} table,th,td{ border:1px solid #B6D5F3; height:25px; line-height:25px;} tr.odd th{ width:120px; text-align:center; background:#930; font-weight:bold;} tr.odd td{ background:#CCC;} tr.even th{} tr.even td{} tfoot td{ text-align:center;} </style> </head> <body> <table> <tbody> <tr class="odd"> <th>商品名称:</th> <td>商品名称商品名称商品名称商品名称</td> </tr> <tr class="even"> <th>颜色:</th> <td>颜色颜色颜色颜色颜色颜色颜色颜色颜色颜色颜色</td> </tr> <tr class="odd"> <th>详细尺寸:</th> <td>详细尺寸详细尺寸详细尺寸详细尺寸详细尺寸详细尺寸</td> </tr> <tr class="even"> <th>其它:</th> <td>其它信息其它信息其它信息其它信息</td> </tr> </tbody> <tfoot> <td colspan="2">表格底部信息</td> </tfoot> </table> </body> </html>
 提示:您可以先修改部分代码再运行
建议你看下这篇帖子:http://bbs.blueidea.com/thread-2841032-1-1.html

作者: wwdsnn   发布时间: 2011-04-19