Table tag in HTML - HTML Tutorial

 table tag

Table tag

  • The <table> element is used to define the tabular data.
  • The data shown by two dimensional data table.
  • The <table> element starts with <table> and ends with </table>.
  • The table element is in the flow content category.
  • The <table> element also support Global Attribute and Event Attribute.
  • In this table element,
    • The row represent as <tr>
    • The header represent as <th>
    • The column represent as <td>

Syntax for table tag:


Differences between HTML 4.01 and HTML5 for table tag:

HTML 4.01

  • The " align ", "bgcolor", "border", "cellpadding", "cellspacing", "frame", "rules", "summary", and "width" attributes are supported.


  • All layout attributes are removed.

Sample Coding for table tag:

Tryit<!DOCTYPE html>
<html >

Code Explanation for table tag:

code explanation for table tag

  1. <table> element - is used to define the data in the table format and starts with <table> and ends with </table>.
  2. border is the attribute of the table that shows the size of the frame around the table.
  3. <tr> element – used to represents the row of the table.
  4. <th> element – used to represents the header of the table.
  5. <td> element – used to represents the data of the table.

Output of <table>Tag:

output for table tag

  1. Here we can see the output is displayed in table format.

Attributes List :

Attribute Value HTML4 HTML5 Description
align left
YES NO Alignment of a table according to surrounding text
bgcolor rgb(x,x,x)
YES YES the background color for a table
border 1
YES NO It mention whether or not the table is being used for layout purposes
cellpadding pixels YES NO the space between the cell wall and the cell content
cellspacing pixels YES NO the space between cells
frame void
YES NO It shows which parts of the outside borders that should be visible
rules none
YES NO which parts of the inside borders that should be visible
sortable sortable YES YES the table should be sortable
summary text YES NO a summary of the content of a table
width pixels
YES NO the width of a table

Browser Support for table tag:

Yes Yes Yes Yes Yes

Related Searches to table tag in html

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add to your ad blocking whitelist or disable your adblocking software.