前端-HTML-表格元素

來源:互聯網
上載者:User

標籤:屬性   sum   style   class   head   標準   格式化   分組   div   

HTML元素分類-表格元素

  0. <table>:定義表格。

    <caption>:定義表格標題。caption 元素緊隨 table 元素之後,每個表格只能定義一個標題,標題置中於表格之上。

<table border="1">  <caption>Monthly savings</caption>  <tr>    <th>Month</th>    <th>Savings</th>  </tr>  <tr>    <td>January</td>    <td>$100</td>  </tr></table>

    <thead>:定義表格的表頭。該元素用於組合表格的表頭內容。

    <tbody>:用於對錶格中的主體內容進行分組。

    <tfoot>:用於對錶格中的表注(頁尾)內容進行分組。

    <tr>:定義表格中的行。

    <th>:定義表格內的表頭儲存格。

    <td>:定義表格中的標準儲存格。

<table border="1">    <thead>        <tr>            <th>Month</th>            <th>Savings</th>        </tr>    </thead>    <tbody>        <tr>            <td>January</td>            <td>$100</td>        </tr>        <tr>            <td>February</td>            <td>$80</td>        </tr>    </tbody>    <tfoot>        <tr>            <td>Sum</td>            <td>$180</td>        </tr>    </tfoot></table>                    

    <colgroup>:組合表格中的列,對其進行格式化。只能在 table 元素中使用。

    <col>:為表格中一個或多個列定義屬性值。只能在 table 或 colgroup 元素中使用 col元素 。

<table border="1">  <colgroup>    <col span="2" style="background-color:red">    <col style="background-color:yellow">  </colgroup>  <tr>    <th>ISBN</th>    <th>Title</th>    <th>Price</th>  </tr>  <tr>    <td>3476896</td>    <td>My first HTML</td>    <td>$53</td>  </tr></table>

    這裡需要注意的是,在H5中,col元素、colgroup元素僅支援屬性span且必須被嵌套在table元素內所有的子項目之前。

    

 

    

前端-HTML-表格元素

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.