CREATING TABLE IN HTML

The <TABLE> tag is used to create a table in HTML. Each table begins with a <TABLE> tag and ends with the </TABLE> tag. You can define various attributes of a table inside the <TABLE> tag as given below:

Table tag

Type:

Container tag

Function:

To create a table on a web page

Syntax:

<TABLE>_</TABLE>

Used within tags:

<BODY>

Let us use these tags to create a table on a web page.

<HTML>

<HEAD>

<TITLE>Creating a table</TABLE>

</HEAD>

<BODY Topmargin=50 Leftmargin=50 Bgcolor="Pink">

<TABLE>

<CAPTION>Student information</CAPTION>

<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 <TABLE>TAG

The <TABLE> tag has many attributes which help in defining different formatting parameters for a table like the width of the entire table, alignment, cellborders, etc. Let us learn about a few of them.

BORDER

This attribute draws a border around the table. The Border attribute tells the table how large the border should be. It specifies the width of the border of a table. If the border attribute is not specified with a table or if its value is zero, then


page no:125
         
Home