Learn how to create tables using HTML


0

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.


Like it? Share with your friends!

0

What's Your Reaction?

hate hate
0
hate
confused confused
0
confused
fail fail
0
fail
fun fun
0
fun
geeky geeky
0
geeky
love love
0
love
lol lol
0
lol
omg omg
0
omg
win win
0
win
Anand Narayanaswamy
Anand Narayanaswamy is the editor-in-chief of Learnxpress. He was a Microsoft Most Valuable Professional (MVP) for a period of 9 years. He is a ASPInsider based in Trivandrum, Kerala State, India. Anand is the author of Community Server Quickly published by Packt Publishing.

0 Comments

Your email address will not be published. Required fields are marked *