NOTE The default value for both Cellpadding and Cellspacing is 2.

HEIGHT AND WIDTH

By default, the size of the table is as large as the data that is entered into it. You can change the overall height and width of the table to get the desired size.

You can specify the height or width either by specifying the size in absolute pixels or in terms of a relative percentage of the screen size.

Example: <TABLE Border=1 Bgcolor="White" Height=300 Width=400>

It is also possible to control the dimensions of individual table cells or rows.

Example: <TR Height=80><TR Width="50%">

Let us use these attributes in the following exanmple:

<HTML>
<HEAD>
<TITLE>Creating a Table </TITLE>
</HEAD>
<BODY Topmargin=50 Leftmargin=50 Bgcolor="Pink">
<TABLE Border=3 Bgcolor="White" Bordercolor="Purple" Background="White-Background.JPG" Align="Center" Cellpadding=10 Cellspacing=10 Height=300 Width=400>
<TR> <TH>S.No. </TH> <TH>Name </TH>
<TH>Grades </TH> </TR>
<TR> <TD>1. </TD> <TD>Bindu </TD>
<TD>A </TD> </TR>
<TR> <TD>2. </TD> <TD>Yogesh </TD>
<TD>A+ </TD> </TR>
<TR> <TD>3. </TD> <TD>Sakshi </TD>
<TD>A </TD> </TR>
</TABLE>
</BODY>
</HTML>

ATTRIBUTES OF THE <TR>, <TD>, AND <TH> TAGS

BORDERCOLOR AND BGCOLOR

You can set the border colour and background colour for the cells of any specific row or column using Bordercolor and Bgcolor attributes of <TR> or <TD> tags. In the same row, you can give different colours to every cell by specifying different colour names or colour codes, using <TD> or <TH> tag. In this case, the colour attribute of <TR> tag does not show any effect.

Learning computers with K ips

131

page no:131
         
Home