14表格基本架構

※表格基本架構

<table border="n" width="x" height="y">

</table>


border屬性用來指定框線粗細,n預設為0。width屬性為表格寛度,height屬性為表格度。

<caption>用來定義表格標題

<th>用來設定標題列,此行文字會以粗體和置中的方式呈現

<tr>用來宣告每一橫列

<td>用來宣告每一直列

========================

程式:

<body>

<table border="1" width="200" height="80">

<caption>第一次段考成績</caption>

<tr>

<th>名次</th>

<th>姓名</th>

<th>成績</th>

</tr>

<tr>

<td>第一名</td>

<td>張大宜</td>

<td>98.3</td>

</tr>

<tr>

<td>第二名</td>

<td>羅小強</td>

<td>96.8</td>

</tr>

</table>

</body>

========================

結果

進階篇:

試試看加入align屬性,結果會變如何?

<td align="center">第二名</td>