Html中的表格

來源:互聯網
上載者:User

標籤:表示   lin   ges   技術   內容   儲存格   bottom   lsp   htm   

表格由<table>標籤來定義。每個表格均有若干行(由<tr> 標籤定義),每行被分割為若干儲存格(由<td>標籤定義)。

字母 td 指表格式資料(table data),即資料儲存格的內容。資料儲存格可以包含文本、圖片、列表、段落、表單、水平線、表格等等。

 

HTML 表格的組成

table:包含表格,表格的開始。

tr:表格的行

th:表格的開頭

td:表格的資料

 

屬性:

cellpadding:表示內容與表格之間的間隙。

cellspacing:儲存格之間和儲存格與邊框的的間隙。

border:設定邊框,顏色,邊框線,大小等

align:設定內容對齊

 

td跨行跨列通過 rowspan 和colspan來實現

案例 如:

     

  代碼中可以看出相關的屬性設定

 

<table cellpadding="15" cellspacing="11px" border="1" width="600px" align="center">            <caption><h3>表名稱</h2></caption>            <tr>                <th align="left">欄位名</th><th>欄位名</th><th>欄位名</th>            </tr>            <tr bgcolor="#008000">                <td align="center">資料</td><td>資料</td><td>資料2</td>            </tr>                        <tr>                <td height="88">資料</td><td>資料</td><td>資料</td>            </tr>            <tr>                <td>資料</td><td colspan="2">資料</td>            </tr>            <tr>                <td>資料s</td><td rowspan="2" valign="bottom">資料</td><td>資料</td>            </tr>            <tr>                <td>資料</td><td>資料</td>            </tr>            <tr>                <td >資料</td>                <td>                    <table width="100%" height="100%" border="1"   >                        <tr>                            <th>欄位名</th><th>欄位名</th><th>欄位名</th>                        </tr>                        <tr bgcolor="#008000">                            <td>資料</th><td>資料</td><td>資料2</td>                        </tr>                    </table>                </td>                <td>資料</td>            </tr>        </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.