HTML table tag

We can create a table in html by using <htmt></htmt> tag.
with in table tag we use <tr> to create new table row.
inside tr we use <td> tag to specify data value.
to provide table header <th> tag is used

One table can contain multiple table rows and each row can contain multiple table data.

Syntax

<th> is optional it is used to provide HTML Table with Header

Example

Sr No Name City
1 Manish Bhilai
1 Mohan Bhopal
1 Ram Banglore

For providing data heading we use <th> tag

HTML Table with border

In above table we have not provided table border to provide HTML table with border we can use border attribute with border tag as below

table border=" 1|0"

0 specify no border around the table
1 specify border around the table

HTML Border attribute in not support by HTML 5.

Insted of border attribute use CSS.

User Name Mailid
Ram [email protected]
Mohan [email protected]
Shyam [email protected]

HTML Table border with CSS

HTML Table With Caption

To provide table caption <caption> tag is used is should be used below the <table> tag

User Name and Mailid details of user
User Name Mailid
Ram [email protected]
Mohan [email protected]
Shyam [email protected]

HTML Table Grouping Tag

<thead>, <tbody> and <tfooter> tags are used for grouping table rows <thead> is used to group table header


<tbody> is used to group table body
<tfooter is used to group table footer