Page 116 - iPlus_Ver_2.0_class_7
P. 116
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 2 or more columns instead of 1, as shown in the table
below:
Roll No. Name Marks Grade
First Last
Here, the “Name” cell takes 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 of three values: “top”, “middle” or "bottom". This is
useful when a text has to be aligned in the 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 given in the table under ROWSPAN.
Attributes of the <TR> Tag
The <TR> stands for Table Row, which is used to start a row and end 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>
<TH> Gender </TH>
</TR>
114
iPlus (Ver. 2.0)-VII

