標籤:表示 lin ges 技術 內容 儲存格 bottom lsp htm
表格由<table>標籤來定義。每個表格均有若干行(由<tr> 標籤定義),每行被分割為若干儲存格(由<td>標籤定義)。
字母 td 指表格式資料(table data),即資料儲存格的內容。資料儲存格可以包含文本、圖片、列表、段落、表單、水平線、表格等等。
HTML 表格的組成
table:包含表格,表格的開始。
tr:表格的行
th:表格的開頭
td:表格的資料
屬性:
cellpadding:表示內容與表格之間的間隙。
cellspacing:儲存格之間和儲存格與邊框的的間隙。
border:設定邊框,顏色,邊框線,大小等
align:設定內容對齊
td跨行跨列通過 rowspan 和colspan來實現
案例 如:
代碼中可以看出相關的屬性設定
<table cellpadding="15" cellspacing="11px" border="1" width="600px" align="center"> <caption><h3>表名稱</h2></caption> <tr> <th align="left">欄位名</th><th>欄位名</th><th>欄位名</th> </tr> <tr bgcolor="#008000"> <td align="center">資料</td><td>資料</td><td>資料2</td> </tr> <tr> <td height="88">資料</td><td>資料</td><td>資料</td> </tr> <tr> <td>資料</td><td colspan="2">資料</td> </tr> <tr> <td>資料s</td><td rowspan="2" valign="bottom">資料</td><td>資料</td> </tr> <tr> <td>資料</td><td>資料</td> </tr> <tr> <td >資料</td> <td> <table width="100%" height="100%" border="1" > <tr> <th>欄位名</th><th>欄位名</th><th>欄位名</th> </tr> <tr bgcolor="#008000"> <td>資料</th><td>資料</td><td>資料2</td> </tr> </table> </td> <td>資料</td> </tr> </table>
Html中的表格