表格(table):類似於Excel格式
table:表格標簽,所有的表格的對象都要放在該標簽中。
tr:表示表格中的一行
td:表示一行中的一個單元格
th:表頭標簽,與td相似。內容樣式上進行加粗,用於設置表頭
caption:表格標題。通常用於描述表的作用
<table width="500px" height="300px" border="1" bordercolor="red" align="center" bgcolor="green" cellspacing="0" cellpadding="10"> <caption>學生信息統計表</caption> <tr> <th>姓名</th> <th>性別</th> <th>年齡</th> </tr> <tr bgcolor="blue" align="center" valign="bottom"> <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>
table標簽的屬性:
border:邊框尺寸
bordercolor:邊框顏色
width;heigth:寬度、高度
align:水平對齊方式(left默認、center、right)
bgcolor:背景色
cellspacing:是表格里單元格之間的距離;
cellpadding:是表格里單元格內的空白部分;
tr標簽屬性:
align:水平對齊方式(left默認、center、right)
bgcolor:背景色
valign:垂直對齊方式(top、middle默認、bottom)
td標簽屬性:
rowspan:行 合並
colspan:列合並
注意判斷好合並的方式,在合並時要刪除相應的td標簽。
例如: