Table merge cells colspan and rowspan

Source: Internet
Author: User

colspanAndrowspanThese two attributes are used to create a special table.

colspanIs the abbreviation of "column span (cross-column.colspanThis attribute is used in the TD tag to specify the number of columns that the cell spans horizontally.:

The following information is displayed in the browser:

Cell 1
Cell 2 Cell 3 Cell 4

In this examplecolspanSet to "3", so that the cell contains three columns. If wecolspanIf it is set to "2", the Cell will only span two columns, so it is necessary to insert another cell in the first row to ensure that the two rows occupy the same number of columns.


This example is displayed in the browser as follows:

Cell 1 Cell 2
Cell 3 Cell 4 Cell 5
rowspanIs used to specify the number of rows that the cell spans vertically..


The browser will display the following:

Cell 1 Cell 2
Cell 3
Cell 4

Cell 1 in the preceding examplerowspanIt is set to "3", which indicates that the cell must span three rows (one row, and the other two rows ). Therefore, cell 1 and Cell 2 are in the same row, while cell 3 and cell 4 form two independent rows.

Integrated instance

SS

<HTML>
<Head>

</Head>

<Table border = "1"Width = "200">
<Tr>
<TD colspan = "4"> SS

</TD>
</Tr>
<Tr>
<TDWidth = "25%" type = "codeph" text = "/codeph"> </TD type = "codeph" text = "/codeph">
<TDWidth = "25%" type = "codeph" text = "/codeph"> </TD type = "codeph" text = "/codeph">
<TDWidth = "25%" type = "codeph" text = "/codeph"> </TD type = "codeph" text = "/codeph">
<TDWidth = "25%" type = "codeph" text = "/codeph"> </TD type = "codeph" text = "/codeph">
</Tr>
<Tr>
<TDWidth = "25%" rowspan = "2"> </TD>
<TDWidth = "25%" type = "codeph" text = "/codeph"> </TD type = "codeph" text = "/codeph">
<TDWidth = "25%" type = "codeph" text = "/codeph"> </TD type = "codeph" text = "/codeph">
<TDWidth = "25%" type = "codeph" text = "/codeph"> </TD type = "codeph" text = "/codeph">
</Tr>
<Tr>

<TDWidth = "25%" type = "codeph" text = "/codeph"> </TD type = "codeph" text = "/codeph">
<TDWidth = "25%" rowspan = "3"> </TD>
<TDWidth = "25%" type = "codeph" text = "/codeph"> </TD type = "codeph" text = "/codeph">
</Tr>
<Tr>
<TDWidth = "25%" colspan = "2"> </TD>
<TDWidth = "25%" type = "codeph" text = "/codeph"> </TD type = "codeph" text = "/codeph">

</Tr>
<Tr>
<TDWidth = "25%" type = "codeph" text = "/codeph"> </TD type = "codeph" text = "/codeph">
<TDWidth = "25%" type = "codeph" text = "/codeph"> </TD type = "codeph" text = "/codeph">
<TDWidth = "25%" type = "codeph" text = "/codeph"> </TD type = "codeph" text = "/codeph">

</Tr>
</Table>

</Html>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.