<table>:表格创建
<tr>:一行的创建
<th>:一个题头
<td>:一个普通单元格
注意:td元素中一定要非空,不然不能显示背景色。
通常组织形式如下
<table>
<tr>
<th></th>
<td></td>
</tr>
</table>
下面介绍<table>的常用属性:
(1)align:可选left\center\right,表明左对齐、右对齐、中间对齐。
(2)bgcolor:背景颜色,可选red\blue等常用颜色。
(3)border:默认表是没边框的,因此这个是创建边框。
(4)cellpadding:单元格的边和实际文本的间隔。
(5)cellspacing:单元格之间的间隙。
下面是<tr>的常用属性:
(1)align:left、center、right。默认<td>左对齐,<th>中对齐
(2)bgcolor:背景色
下面是<td>和<th>的常用属性:
(1)abbr:提供单元格的缩写版本。
(2)bgcolor
(3)colspan:一个单元格跨越的列的数量。
(4)nowrap:阻止文本换行。nowrap = "nowrap"
(5)rowspan:跨越行的数量。
<html>
<head><title>Home</title></head>
<body>
<table cellspacing = "2">
<tr bgcolor = "orange">
<th></th>
<th>Saturday</th>
<th>Sunday</th>
</tr>
<tr>
<th bgcolor = "orange">Morning</th>
<td>Hello world</td>
<td>Hello world</td>
</tr>
<tr>
<th bgcolor = "orange">Afternoon</th>
<td>Hello world</td>
<td>Hello world</td>
</tr>
</table>
</body>
</html>