Learn how to create tables using HTML

One of the unique features of HTML is its ability to create tables. A developer can easily integrate the data’s into a table very easily. As usual you have to apply the tags appropriately.

First, you should create a heading and then rows are to be created one by one. Following example will help you to understand the concept better:

<TABLE><TR><TH>Sl No: <TH>Name<TR><TD>1<TD>Mark <TR><TD>2<TD>Paul <TR><TD>3<TD>Mike</TABLE>

Here 3 rows and 2 columns are created. You can apply some modifications by applying the following attributes.

Attributes applicable to <TABLE> tag

Border: Changes the border of the table. Default Border is 1.
Bgcolor: Changes the background color of the table.
Align: Aligns the table to left, center and right. Default Alignment is left.
Cell Padding: It indicates the space between the border and content of the cell.
Cell Spacing: It indicates the space between two cells.

Attributes applicable to <TR> AND <TD> tag

Two important attributes associated with these tags are Bgcolor and align attribute. For example if you apply bgcolor like this <TR bgcolor = “yellow”>, only the background color of the row will be changed whereas if you apply it in TABLE tag, whole of the Table will be of that color. <TR bgcolor = “yellow”>, only the background color of the row will be changed whereas if you apply it in TABLE tag, whole of the table will be of that color.

Now let us try out one example:

<HTML><HEAD><TITLE>Working with Tables</TITLE></HEAD><BODY><TABLE><TR><TH>Serial No: <TH>Name:<TH>Marks:<TR><TD>100<TD>Mark<TD>250<TR><TD>101

<TD>Philips<TD>300<TR><TD>103<TD>Tom<TD>450</TABLE></BODY></HTML>

Note: It is not necessary to close the <TR> and <TD> tags.

READ  DiscountASP.NET Upgrades and Extends Free Sandbox Hosting for Developers

Leave a Reply

Your email address will not be published.