Introduction:

In this article we will learn what is table tag in html or how to use a table in html with example.

Description:

HTML table tag is used to display data in tabular format (row & column).

In a table can have more than one row. There can be many columns in a row.

 

HTML tables are used to manage the layout of the page e.g. header section, navigation bar, body content, footer section etc. But it is recommended to use div tag over table to manage the layout of the page 


Let's take a simple example:

 <!DOCTYPE>
<html>
<head>
    <title>Example of table tag</title>
</head>
<body>
    <table border="1">
        <tr><th>Product Name</th><th>Brand</th><th>Price</th></tr>
        <tr><td>Laptop</td><td>Lenovo</td><td>20000</td></tr>
        <tr><td>Computer</td><td>Intel</td><td>8000</td></tr>
        <tr><td>Mouse</td><td>Intex</td><td>200</td></tr>
        <tr><td>Mobile</td><td>samsung</td><td>10000</td></tr>
    </table> 
</body>
</html> 

Output:

 use of html table

 

HTML Table Tags


<table>: It is use to define a table.

<tr>: It is use to define a row in a table.

<th>: It is use to define a header cell in a table.

<td>: It is use to define a cell in a table.

<caption>: It is use to define the table caption.

<colgroup>: It is use to specify a group of one or more columns in a table for formatting.

<col>: It is used with <colgroup> element to specify column properties for each column.

<tbody>: It is used to group the body content in a table.

<thead>: It is used to group the header content in a table.

<tfooter>: It is used to group the footer content in a table.

 

I hope this article will help to you after reading.

0 comments


Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.

You may also like