Mastering HTML: Step-by-Step Guide to Creating Tables

Joan Jul 01, 2026

Welcome to our guide on how to write a table in HTML. HTML tables are a great way to display data in a structured format, making it easy for users to understand and navigate. Let's dive right in and learn how to create and style tables in HTML.

HTML Tables Tags Tutorial with Example โ€” TutorialBrain
HTML Tables Tags Tutorial with Example โ€” TutorialBrain

HTML tables are created using the <table> tag, with each row defined by the <tr> tag, and each cell by the <td> tag. The <th> tag is used for table headers. Here's a simple example:

๐Ÿงพ How to Create Tables in HTML
๐Ÿงพ How to Create Tables in HTML

Creating a Basic Table

To start, let's create a basic table with some data. We'll use the <table>, <tr>, <th>, and <td> tags as shown below:

HTML Table
HTML Table
Name Age
John Doe 30
Jane Smith 28

Understanding Table Structure

HTML Basic Tables
HTML Basic Tables

The <table> element is the container for the table data. Each row of the table is defined by the <tr> tag. Inside each <tr>, <th> is used for table headers, and <td> for table data.

In the example above, the first row contains headers for 'Name' and 'Age'. The subsequent rows contain data for these headers.

Adding More Rows and Columns

HOW TO MERGE TABLE CELLS IN HTML
HOW TO MERGE TABLE CELLS IN HTML

To add more rows to the table, simply add more <tr> tags with the appropriate <td> or <th> tags. To add more columns, add more <th> or <td> tags within the <tr> tags.

For example, to add another column for 'Country', you would modify the table like this:

Name Age Country
John Doe 30 USA
Jane Smith 28 Canada
an image of a table with many lines
an image of a table with many lines

Styling Tables with CSS

While HTML is used to structure the table, CSS is used to style it. You can apply CSS styles to the <table>, <tr>, <th>, and <td> tags to change the appearance of the table.

how to create html table | HTML TABLE TAG
how to create html table | HTML TABLE TAG
๐Ÿ“Š Combine Table Cells in HTML
๐Ÿ“Š Combine Table Cells in HTML
A Detailed Guide to HTML Tables | Simplilearn
A Detailed Guide to HTML Tables | Simplilearn
Responsive HTML Table With Rounded Corners
Responsive HTML Table With Rounded Corners
Sortable Table In HTML Javascript
Sortable Table In HTML Javascript
the table borders for different types of text
the table borders for different types of text
Top 9 HTML Table Builders to use Free
Top 9 HTML Table Builders to use Free
an image of a web page with the text'how to write a html list '
an image of a web page with the text'how to write a html list '
Simple Searchable Table In HTML Javascript
Simple Searchable Table In HTML Javascript
Sortable Table with HTML & Javascript
Sortable Table with HTML & Javascript
an image of a computer screen with the words html and table part 1 on it
an image of a computer screen with the words html and table part 1 on it
an info sheet describing the different types of web pages and how they are used to create them
an info sheet describing the different types of web pages and how they are used to create them
Table In CSS | How To Create Table In CSS | In Urdu/Hindi | #16 | CSS Tutorials
Table In CSS | How To Create Table In CSS | In Urdu/Hindi | #16 | CSS Tutorials
html notes
html notes
Very Simple Editable HTML Table
Very Simple Editable HTML Table
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 Cheet Sheet
Html Cheet Sheet
a screenshot of a computer screen with the text'html tables'on it
a screenshot of a computer screen with the text'html tables'on it
Complete Beginner HTML Master Notes
Complete Beginner HTML Master Notes
an image of a computer screen with the text, table headings and tables headings
an image of a computer screen with the text, table headings and tables headings

For example, to add some basic styles like border, background color, and text alignment, you can use the following CSS:

Using the <colgroup> and <col> Tags

The <colgroup> and <col> tags allow you to apply styles to specific columns. For example, to make the 'Age' column bold, you can use the following:

Name Age Country
John Doe 30 USA
Jane Smith 28 Canada

Now that you know how to create and style tables in HTML, it's time to put your new skills into practice. Start by creating a simple table, then gradually add more rows and columns. Once you're comfortable with the basics, explore more advanced table features like rowspan and colspan.