Table Tag in HTML Tutorialspoint Complete Guide with Examples

The

tag in HTML is a fundamental part of web design, used to create tables on a webpage. It's an essential tool for displaying information in rows and columns, making data easily understandable and manageable.

HTML Tables Tags Tutorial with Example — TutorialBrain
HTML Tables Tags Tutorial with Example — TutorialBrain

Tables allow you to add structure to your data, with each

capable of holding numerous (table row) and
(table data) tags. These tags, in turn, contain the specific data you wish to display.

an image of a table with many lines
an image of a table with many lines

Understanding the Basic Structure

To get started with the

tag, you need to understand its basic structure. The
element is used as the parent container, while is used to create rows of data, and tags for additional rows and more
is employed to insert data into these rows.

Commonly Used HTML Tags with Examples - DataFlair
Commonly Used HTML Tags with Examples - DataFlair

Here's a simple example to illustrate this:

Creating a Simple Table

🧾 How to Create Tables in HTML
🧾 How to Create Tables in HTML

To create a basic table, you can use the following code:

<table>
  <tr>
    <td>Header 1</td>
    <td>Header 2</td>
  </tr>
  <tr>
    <td>Data 1</td>
    <td>Data 2</td>
  </tr>
</table>

The above code results in a table with two rows: one for headers and one for data. Each row contains two cells, displaying the respective data.

Adding More Rows and Columns

Quick HTML Tags Cheat Sheet
Quick HTML Tags Cheat Sheet

You can expand this table by adding more rows and columns as needed. Simply add more

tags within those rows for extra columns:

<table>
  <tr>
    <td>Header 1</td>
    <td>Header 2</td>
    <td>Header 3</td>
  </tr>
  <tr>
    <td>Data 1</td>
    <td>Data 2</td>
    <td>Data 3</td>
  </tr>
</table>

This code will produce a table with three columns and two rows.

Enhancing Tables with Additional Features

how to create html table | HTML TABLE TAG
how to create html table | HTML TABLE TAG

Tables in HTML can be further enhanced with additional attributes and styles to make them more functional and visually appealing.

Adding Caption and Borders

the ultimate guide to creating and formating tags
the ultimate guide to creating and formating tags
HTML Table
HTML Table
HTML TAG
HTML TAG
tables in html table with text and images on the page, which is displayed below
tables in html table with text and images on the page, which is displayed below
887 reactions · 135 shares | HTML5 Tags information 2026. #coding #webdevelopment✨ #htmlcssjavascript #programming | Premi Coding | Facebook
887 reactions · 135 shares | HTML5 Tags information 2026. #coding #webdevelopment✨ #htmlcssjavascript #programming | Premi Coding | Facebook
About HTML tags
About HTML tags
Top 9 HTML Table Builders to use Free
Top 9 HTML Table Builders to use Free
List of HTML Tags
List of HTML Tags
HOW TO MERGE TABLE CELLS IN HTML
HOW TO MERGE TABLE CELLS IN HTML
Responsive Table V1 - Free HTML/CSS Table Template 2026 - Colorlib
Responsive Table V1 - Free HTML/CSS Table Template 2026 - Colorlib
Why You Shouldn't Get Caught Using Tables for Web Page Layouts
Why You Shouldn't Get Caught Using Tables for Web Page Layouts
HTML Formatting — Text Formatting Tags — TutorialBrain
HTML Formatting — Text Formatting Tags — TutorialBrain
the table borders for different types of text
the table borders for different types of text
Responsive HTML Table With Rounded Corners
Responsive HTML Table With Rounded Corners
two different types of web pages with the same text and numbers in each one language
two different types of web pages with the same text and numbers in each one language
All HTML Tags List with Example PDF - InstaPDF
All HTML Tags List with Example PDF - InstaPDF
HTML Tags — List of all HTML Tags with Examples TutorialBrain
HTML Tags — List of all HTML Tags with Examples TutorialBrain
Essential HTML Tags Every Web Developer Needs! 🏷️
Essential HTML Tags Every Web Developer Needs! 🏷️
HTML TAGS | PART 1
HTML TAGS | PART 1
CSS Table Layout
CSS Table Layout

You can provide a caption for your table using the

tag, and apply borders to your table with the border attribute:

<table border="1">
  <caption>Table Caption</caption>
  <tr>
    <td>Header 1</td>
    <td>Header 2</td>
  </tr>
  <tr>
    <td>Data 1</td>
    <td>Data 2</td>
  </tr>
</table>

Adding a border around your table can help separate it from the rest of the page, while a caption provides a helpful title for the data inside.

Spanning Columns and Rows

Sometimes, you might want to span a column or a row across multiple columns or rows, for instance, to merge header cells. This can be achieved using the colspan and rowspan attributes:

<table>
  <tr>
    <td colspan="2">Merged Header</td>
  </tr>
  <tr>
    <td>Header 1</td>
    <td>Header 2</td>
  </tr>
  <tr>
    <td>Data 1</td>
    <td>Data 2</td>
  </tr>
</table>

The first cell in this table spans across two columns, appearing as a merged cell in the output.

Understanding and effectively using the

tag is crucial in web design, allowing you to present data in a structured and efficient manner. Given its versatile nature, it's a powerful tool in your HTML toolkit. Now that you've grasped its basics, start exploring more advanced table features to take your HTML skills to the next level.