colspan
Androwspan
These two attributes are used to create a special table.
colspan
Is the abbreviation of "column span (cross-column.colspan
This 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 examplecolspan
Set to "3", so that the cell contains three columns. If wecolspan
If 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 |
rowspan
Is 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 examplerowspan
It 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
<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>