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> |
|---|
The columns contain cells, each of which begins with the <TD> (table data) tag and ends with </TD>tag. The <TD> tag must always be present inside the <TR> tag.
To specify a column heading, we use the <TH>tag that also ends with </TH> tag. It makes the text bold.
The <CAPTION>tag is used inside the <TABLE>tag to specify the caption of the table.
< THEAD>, <TBODY>, and <TFOOT> tags are also used to define the specific sections of a table.
![]() |
<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> |
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.
BORDERThis 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