Table
HTML <table> 元件代表表格數據──換句話說,就是透過二維資料表來呈現資訊。
<table>
<thead>
<tr>
<th colspan="2">The table header</th>
</tr>
</thead>
<tbody>
<tr>
<td>The table body</td>
<td>with two columns</td>
</tr>
</tbody>
</table>
table,
td {
border: 1px solid #333;
}
thead,
tfoot {
background-color: #333;
color: #fff;
}屬性
align
這個枚舉屬性會指示表格中的文字要如何對齊。可用值如下:
left:意思是表格應該顯示在文件的左方。
center:意思是表格應該顯示在文件的中間。
right:意思是表格應該顯示在文件的右方。
在 CSS 要得出類似效果,應該設定 margin-left與 margin-right;如果要置中,則要把 margin 屬性設定為 0 auto。
Sticky position
Last updated
Was this helpful?