1.表格语法:
- <table>标签定义表格。
- <tr>定义表格中的一行,<td>定义表格中一行中的一格。
<table> <tr> <td>n11</td> <td>n12</td> </tr> <tr> <td>n21</td> <td>n22</td> </tr> </table>
显示结果:
2.表头标签:
使用<th>来进行表个首行的特殊显示,代码如下:
<tr>
<th>head1</th>
<th>head2</th>
</tr>
代码显示效果:
3.表格属性:在此声明,表格标签这部分我们实际开发不常用,一般会使用css来设置。
首先看一下以下的几种属性:
下面我将这串代码输入:
<table align="center" border="1" cellpadding="10" cellspacing="0" width="10">
</table>
效果如下:
这里我解释一下,center表示表格所在行居中,cellpadding表示文字与边框之间的距离,cellspacing表示内边框和外边框之间的距离,width和cellspacing的相关我举个例子,如下:
cellspacing="10" width="500"
效果如下:
4.同样表格也有height属性:
height=“100”
效果: