实例:一个简单的表格
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>表格</title> </head> <body> <!--border:表格边框宽度--> <!--cellspqcing:表格边框内间距--> <!--cellpadding:单元表格连字体距离表格的编边距--> <table border="1" cellspacing="0" cellpadding="8" align="left" width="500" > <caption>购物车</caption> <thead align="center" bgcolor="#00ced1"> <tr> <th>编号</th> <th>名称</th> <th>单价</th> <th>数量</th> <th>金额</th> <th>类型</th> </tr> </thead> <tbody align="center"> <tr> <td >1</td> <td>中华牌电动牙刷</td> <td>2</td> <td>5</td> <td>10</td> <td>生活用品</td> </tr> <!-- rowspan:竖向合并--> <!-- colspan:横向合并--> <tr> <td>2</td> <td>青菜</td> <td>2</td> <td>5</td> <td>10</td> <td rowspan="2">蔬菜</td> </tr> <tr> <td>3</td> <td>土豆</td> <td>2</td> <td>5</td> <td>10</td> </tr> </tbody> <tfoot align="center"> <tr > <td colspan="3">合计</td> <td>15</td> <td>30</td> <td></td> </tr> </tfoot> </table> </body> </html>
运行实例 »
点击 "运行实例" 按钮查看在线实例