1. 程式人生 > >python學習之HTML-table標籤

python學習之HTML-table標籤

表格(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標籤。

  例如: