What Is The HTML <table> Tag?

What Is The HTML Table Tag

Date First Published: 16th January 2023

Topic: Web Design & Development

Subtopic: Web Development

Article Type: Computer Terms & Definitions

Difficulty: Medium

Difficulty Level: 5/10

Learn more about what the HTML <table> tag is in this article.

The HTML <table> tag is used to define a table within a HTML document, allowing data to be represented in columns and rows. A HTML table consists of one <table> element and one or more <tr> (used to define a row), <th> (used to define a header), and <td> (used to define a table cell) elements. These are the basic elements that make up and control the size of the table. A HTML table may also include <caption>, <colgroup>, <thead>, <tfoot>, and <tbody> elements.

Example Of The <table> Tag

An example of a HTML table created using the <table> tag can be seen below:

<table> <tr> <th>Month</th> <th>Number of Days</th> <tr> <td>January</td> <td>31</td> <td> <td>February</td> <td>28 (29 in a leap year)</td> <td> <td>March</td> <td>31</td> <td> <td>April</td> <td>30</td> <td> <td>May</td> <td>31</td> <td> <td>June</td> <td>30</td> </tr> <td> <td>July</td> <td>31</td> </tr> <td> <td>August</td> <td>31</td> </tr> <td> <td>September</td> <td>30<td> </tr> <td> <td>October</td> <td>31<td> </tr> <td> <td>November</td> <td>30<td> </tr> <td> <td>December</td> <td>31<td> </tr> </table>

Month Number of Days
January 31
February 28 (29 in a leap year)
March 31
April 30
May 31
June 30
July 31
August 31
September 30
October 31
November 30
December 31

Note: Info Icon

Tables can be styled using CSS to improve the appearance of them. The table above was styled.


Feedback

  • Is there anything that you disagree with on this page?
  • Are there any spelling, grammatical, or punctuation errors on this page?
  • Are there any broken links or design errors on this page?

If so, it is important that you tell me as soon as possible on this page.