HTML進階標籤之表格標籤,html表格標籤

來源:互聯網
上載者:User

HTML進階標籤之表格標籤,html表格標籤

 前面學習了一下HTML的常用標籤, 今天開始進階標籤之路!


一.表格標籤


1.作用: 建立一張表格


2.各屬性作用:

<table cellspacing="0" cellpadding="0"></table> <!--表格標籤 cellspacing:單元格邊距. cellpadding: 單元格間距-->

<caption> </caption> <!--caption: 置於table內部,<tr>標籤之前, 未設定特定位置時, 會隨著表格的移動而移動 -->

<td colspan="1" rowpan="3"></td> <!--colspan: 規定單元格可橫跨的列數. rowpan: 規定單元格可橫跨的行數. 注意: 這兩種屬性使用時, 要將被合并的單元格刪除, 否則會出現單元格被擠出-->

<th></th> <!--與<td>標籤區別: 加粗置中-->


3.程式碼範例:

<!DOCTYPE html><html>  <head>    <title>表格的應用</title><meta charset="utf-8">    <meta name="keywords" content="keyword1,keyword2,keyword3">    <meta name="description" content="this is my page">    <meta name="content-type" content="text/html; charset=UTF-8">        <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->  </head>    <body>    <a href="Main.html">返回首頁</a>        <!-- table: 表格標籤. cellspacing:儲存格邊距. cellpadding:儲存格間距 -->    <table border="1" width="400" align="center" cellspacing="0" cellpadding="0">    <caption align="center"> <!-- caption: 置於table標籤內部, <tr>標籤之前, 未設定特定的位置時,會隨著表格的移動而移動 -->    <h1>我的表格</h1>    </caption>    <tr>    <th>編號</th> <!-- 與<td>標籤唯一不同: 加粗置中 -->    <th>姓名</th>    <th>性別</th>    <th>職務</th>    <th>手機</th>    </tr>        <tr>    <td>1</td>     <td>老大</td>    <td>男</td>    <td>董事長</td>    <td>18910504201</td>    </tr>        <tr>    <td>2</td>    <td>老二</td>    <td colspan="1" rowspan="3" align="center">女</td> <!-- colspan: 規定單元可橫跨的列數. rowspan: 規定儲存格可橫跨的行數,    這兩種屬性使用時, 要將被合并的儲存格刪除, 否則會出現單元    格被擠出 -->    <td>總經理</td>    <td>133111111111</td>    </tr>         <tr>    <td>3</td>    <td>老三</td>    <td colspan="1" rowspan="2" align="center">副總</td>    <td>13322222222</td>    </tr>         <tr>    <td>4</td>    <td>老四</td>    <td>13333333333</td>    </tr>         <tr>    <td>5</td>    <td>老五</td>    <td>男</td>    <td>總監</td>    <td>13344444444</td>    </tr>    </table>  </body></html>

4.運行結果


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.