一、基本语法
- <table> \\表格标记
- <tr> \\表格行标记
- <td>......</td> \\单元格标记
- ...
- ...
- </tr>
- ....
- ....
- </table>
二、表格标记的常用属性,table,tr,td都可以使用
- 基本的
- border \\设置表格边框线的宽度
- width,height \\表格的宽度和高度
- bgcolor \\表格背景颜色
- background \\设置背景图像
- bordercolor \\设置边框颜色
- bordercolorlight \\亮边框颜色
- bordercolordark \\暗边框颜色
- 更多
- cellspacing \\设置单元格间距
- cellpadding \\设置单元格边距
- align \\设置表格水平对齐的方式
- rowspan,colspan \\单元格跨行/单元格跨列
- frame \\设置表格边框的样式,是否显示
- --above \\显示上边框
- --below \\显示下边框
- --border,box \\显示上下左右边框
- --lhs,rhs \\显示左边框,显示右边框
- --hisdes,visdes \\显示上下边框,显示左右边框
- --void \\不显示边框
- rules \\设置表格内部边框的样式,是否显示
- --all \\显示所有内部边框
- --cols \\仅显示行边框
- --groups \\仅显示介于行列间的边框
- --none \\不显示内部边框
- --rows \\仅显示列边框
三、简单示例,重点在table里面
- <!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>
- </head>
- <body>
- <table bgcolor="#CCCC33" width="366" height="151" border="0">
- <tr>
- <td>1</td>
- <td>2</td>
- <td>3</td>
- </tr>
- <tr>
- <td>4</td>
- <td>5</td>
- <td>6</td>
- </tr>
- <tr>
- <td>7</td>
- <td>8</td>
- <td>9</td>
- </tr>
- </table>
- </body>
- </html>
转载于:https://blog.51cto.com/linuxguest/450718