HTML merge Cells

Source: Internet
Author: User

This morning, it was a great help to merge cells when designing the title bar. In the past, I knew very little about the table attributes!

 

When HTML is used to merge cells, the following attributes are used:Cross-row merge: rowspan,Cross-column merge: colspan.

Part 1: rowspanUsage

 

<Table border = 2 width = "50%">
<Tr>
<TDRowspan = 2> Row 1, entry 1 </TD>
<TD> Row 1, entry 2 </TD>
</Tr>
<Tr> <TD> Row 2, entry 1 </TD> </tr>
</Table>

1. The effect when rowspan is not added is:

Row 1, entry 1, Row 1, entry 2

Row 2, entry 1

2. The effect after adding rowspan is:

Row 1, entry 1, Row 1, entry 2

Row 2, entry 1

 

 

 

Part 2: colspan usage

 

<Table border = 2 width = "50%">
<Tr>
<TD> Row 1, entry 1 </TD>
<TD> Row 1, entry 2 </TD>
</Tr>
<Tr> <TDColspan= 2 align = "center"> Row 2, entry 1 </TD> </tr>
</Table>

1. The effect when rowspan is not added is:

Row 1, entry 1, Row 1, entry 2

Row 2, entry 1 "NO content"

2. The effect after adding rowspan is:

Row 1, entry 1, Row 1, entry 2

Row 2, entry 1 (entire as a cell)

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.