Page 170 - Web Applications (803) Class 11
P. 170
Ð ÐROWSPAN: The Rowspan attribute applies when a single cell is extended for more than a single row, that is, the cell
spans for 2 or more rows instead of 1 as shown in the below table.
Category Types
Badminton
Sports Football
Basketball
Judo
Martial Arts Karate
Here, the cell “Sports” is taking a span of 3 rows and “Martial Arts” is taking a span of 2 rows. An example of using
the ROWSPAN attribute is:
<TD ROWSPAN="3">
Ð ÐCOLSPAN: The Colspan attribute applies when a single cell is extended to more than a single column, that is, the cell
spans for 2 or more columns instead of 1 as shown in the table below:
Roll No. Name Marks Grade
First Last
Here, the “Name” cell is taking a span of 2 columns. An example of using the COLSPAN attribute is:
<TD COLSPAN="2">
Ð ÐVALIGN: The VALIGN attribute is used to align the position of text in the cell vertically, that is, vertical alignment. It
can take any one from three values, “top”, “middle” and "bottom". This is useful when a text has to be aligned in
case of rowspan. Consider the table with rowspan (previously used). The text “Sports” appears to be in the middle
and “Martial Arts” at the bottom vertically with respect to the Types column.
Attributes of the <Tr> Tag
The <TR> stands for Table Row, which is used to start a row and ends up with </TR>. It is a container tag. All the
attributes discussed with the <TD> tag can also be used with the <TR> tag, except the Rowspan and Colspan attributes.
HTML Code to Create a Table
Let us create a table using the <table> tag.
<HTML>
<HEAD> <TITLE> Students of Class </TITLE>
</HEAD>
<BODY BGCOLOR = "yellow">
<TABLE BORDER="1" BORDERCOLOR="RED">
<CAPTION> <B> Table : Student </B> </CAPTION>
<TR BGCOLOR="lightgreen">
<TH> Roll No. </TH>
<TH> Name </TH>
<TH> Grade </TH>
168 Touchpad Web Applications-XI

