How to Create Table in HTML with Example W3Schools A Complete Guide

Logan Jul 13, 2026

Creating tables in HTML is a fundamental aspect of web design, allowing you to present data in an organized and readable format. Let's delve into how to create a table in HTML, using clear examples inspired by W3Schools, a trusted source for learning web development.

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

Tables in HTML are defined with the `

` tag, while individual data cells are defined with the `` tag to define table data rows:

` tag, and header cells are defined with the `` tag. Here's a simple example of a table structure:

HTML Table
HTML Table

Basic Table Structure

A basic table structure consists of a header and one or more data rows.

HTML Basic Tables
HTML Basic Tables

Each table must contain a `

` element, and one or more `` elements for each table row. Inside each `` element, you can have one or more `` tag to define table headers:

` (for table data) or `` (for table headers) elements.

Table Headers

Welcome to SiteRaw
Welcome to SiteRaw

The `

` tag defines a header cell in a table. Header cells are usually bold and centered by default. You can use the `` tag within the `
Header 1 Header 2

Table Data

Editable HTML Table
Editable HTML Table

The `

` tag defines a standard cell in a table. You can use the `` tag within the `
Header 1 Header 2
Data 1 Data 2

Table Attributes

HTML Table Image and Text Align | How To Make Responsive Table Design Using CSS | With Source Code
HTML Table Image and Text Align | How To Make Responsive Table Design Using CSS | With Source Code

You can use various attributes to style and manage your tables. Here are two common attributes:

Width and Height

πŸ“Š Combine Table Cells in HTML
πŸ“Š Combine Table Cells in HTML
Chapter 5: HTML – Create Lists and Tables
Chapter 5: HTML – Create Lists and Tables
Simple Searchable Table In HTML Javascript
Simple Searchable Table In HTML Javascript
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
Sortable Table with HTML & Javascript
Sortable Table with HTML & Javascript
Student Registration Form in HTML with CSS | Completely Free
Student Registration Form in HTML with CSS | Completely Free
an image of a table with numbers and symbols on the top right hand corner that says tables
an image of a table with numbers and symbols on the top right hand corner that says tables
30 Best Free HTML/CSS Table Templates Templates 2026 - Colorlib
30 Best Free HTML/CSS Table Templates Templates 2026 - Colorlib
Want to learn more programming concepts and tips.? 😎

πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡

Follow @codecampusng for moreπŸ“±πŸš€

πŸ‘†πŸ‘†πŸ‘†πŸ‘†πŸ‘†πŸ‘†πŸ‘†πŸ‘†

β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”

How to Create a Simple Table in HTML and CSS

β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”

How easy was that? Let us know in the comment section

β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”

Begin your journey as a Developer today. Click the Link in Bio

β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”

#programming #communication #technology #tech #programmers #web #code #webdeveloper #programmer #webdesign #python #css #frameworks #webdevelopment #webdesign #html5 #campus... Communication, Simple Table, Web Development, Web Design, It Works, Coding, Let It Be
Want to learn more programming concepts and tips.? 😎 πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡ Follow @codecampusng for moreπŸ“±πŸš€ πŸ‘†πŸ‘†πŸ‘†πŸ‘†πŸ‘†πŸ‘†πŸ‘†πŸ‘† β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” How to Create a Simple Table in HTML and CSS β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” How easy was that? Let us know in the comment section β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” Begin your journey as a Developer today. Click the Link in Bio β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” #programming #communication #technology #tech #programmers #web #code #webdeveloper #programmer #webdesign #python #css #frameworks #webdevelopment #webdesign #html5 #campus... Communication, Simple Table, Web Development, Web Design, It Works, Coding, Let It Be
an image of a table with many lines
an image of a table with many lines
Top 9 HTML Table Builders to use Free
Top 9 HTML Table Builders to use Free
the table is labeled with different names for each type of item in this text box
the table is labeled with different names for each type of item in this text box
CSS Responsive Table With HTML & jQuery | CSS HTML Table
CSS Responsive Table With HTML & jQuery | CSS HTML Table
Colorful CSS Table | Styling Table With CSS | In Urdu/Hindi | #17 | Table In CSS
Colorful CSS Table | Styling Table With CSS | In Urdu/Hindi | #17 | Table In CSS
Javascript CSV To HTML Table
Javascript CSV To HTML Table
an image of a computer screen with the text,'html tables'on it
an image of a computer screen with the text,'html tables'on it
Complete Beginner HTML Master Notes
Complete Beginner HTML Master Notes
Tables in HTML
Tables in HTML
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
the table of contents is shown in this info sheet, which shows how to use it
the table of contents is shown in this info sheet, which shows how to use it

You can specify the width and height of a table using the `width` and `height` attributes. The `width` and `height` attributes are generally measured in pixels (px):

Cell 1 Cell 2

Styling with CSS

For advanced styling, it's recommended to use CSS. Here's an example of styling a table using an external CSS file:

Cell 1 Cell 2

In your external CSS file, you can style the table using:

```css #styled-table { border-collapse: collapse; width: 100%; } #styled-table th, #styled-table td { border: 1px solid black; text-align: left; padding: 16px; } #styled-table th { background-color: #f2f2f2; } ```

Now that you've learned how to create tables in HTML, it's time to practice and create your own. So, grab your text editor and start building! Who knows, you might even create the next groundbreaking web application with your newfound table creation skills.