Page 183 - Webapplication11_C11_Flipbook
P. 183
For example,
<TD ALIGN="center">
Ð ÐBGCOLOR: The Bgcolor attribute is used to give background color to an individual cell wherever it is specified. For
example,
<TD BGCOLOR="Pink">
Ð ÐWIDTH: The Width attribute defines the width of an individual cell when specified either in pixels or in percentage
of the the table width. For example,
<TD WIDTH=30> or <TD WIDTH=40%>
In the same way, you can use the HEIGHT attribute.
Ð Ð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.
Website Building Using HTML and CSS 181

