ta HTML <table> Tag – Algbly
Loading...
HTML <table> Tag

HTML <table> Tag

In this tutorial, we will learn about table tag in HTML with the help of examples.


<table> Tag

Table tag <table> is used to defines a HTML table.
The table tag contain other tags like <tr>, <th>, <td> tag that define the structure of the table.

Syntax

<table>..........</table>

Example

<!DOCTYPE html>
<html>
  <head>
    <title>Table tag</title>
  </head>
  <body>
    <table>
      <tr>
        <th>First Name</th>
        <th>Last Name</th>
        <th>Age</th>
      </tr>
      <tr>
        <td>Sunny</td>
        <td>Chaudhary</td>
        <td>20</td>
      </tr>
      <tr>
        <td>Anu</td>
        <td>Chaudhary</td>
        <td>19</td>
      </tr>
    </table>
  </body>
</html>

Output :

Image Not Loaded

Specific Attribute

Attribute Value Description
abbr abbreviated_text It specifies an abbreviated version of the content in a cell
align right
left
center
justify
char
It is used for visual alignment
bgcolor rgb(x,x,x)
#hexcode
color_name
It specifies the background color of the table
border pixels It specifies the border width. A value of 0 means no border
cellpadding pixels
percentage(%)
It specifies the space between the cell borders and their contents
frame void
above
below
hsides
lhs
rhs
vsides
box border
It is used in conjuction with the border attribute which specifies the side of the frame that makes up the border surrounding the table is displayed.
rules none
groups
rows
cols
all
It is used in conjuction with the border attribute, specifies which rules appears between the cells of the table.
summary text It is used to specify the summary of the content
width pixels
percentage(%)
It is used to specify the width of the table.

Global Attribute

Table Tag support all the global attributes of HTML.


Event Attribute

Table Tag support all the event attributes of HTML.


Next Tutorial

We hope that this tutorial helped you develop better understanding of the concept of <table> tag in HTML.

Keep Learning : )

In the next tutorial, you'll learn about HTML <tbody> Tag.

- Related Topics