Simple HTML Table Code Example For Beginners A Step By Step Guide

Creating tables in HTML is a fundamental aspect of web development, enabling you to present data in a clear and organized manner. HTML tables are particularly useful for displaying tabular data, with rows and columns that can be easily structured and styled. Let's dive into a simple HTML table code example and explore its components in depth.

HTML Table
HTML Table

At its core, an HTML table is defined by the `

` tag, with each row denoted by the `` tag, and each cell by the ``, ``, and `` tags can be used to separate headers, body, and footer rows respectively. Let's start with a basic table structure.

HTML Basic Tables
HTML Basic Tables

Creating a Basic HTML Table

A fundamental HTML table consists of a table with some rows and columns. Here's a simple example:

HTML Tables Tags Tutorial with Example โ€” TutorialBrain
HTML Tables Tags Tutorial with Example โ€” TutorialBrain
` (table data) or `` (table header) tags. The `
Header 1 Header 2
Data 1 Data 2

In this example, we have a table with one row of headers and one row of data. Now, let's look at how to add more rows and columns.

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

Increasing Rows and Columns

To create more rows, simply add more `` elements. For additional columns, include more `` (or `` for headers) elements within each row. Here's an expanded version: ```html

Header 1 Header 2 Header 3
Data 1 Data 2 Data 3
Data 4 Data 5 Data 6

```

In this table, we added new headers and data, expanding both the rows and columns.

Display CSV As HTML Table In PHP
Display CSV As HTML Table In PHP

Spanning Columns with <colspan>

To create a cell that spans multiple columns, use the `` attribute. Here's how to modify our previous example to span the first header across two columns: ```html

Combined Header Header 3
Data 1 Data 2 Data 3

```

The newly combined header now spans two columns.

๐Ÿ“Š Combine Table Cells in HTML
๐Ÿ“Š Combine Table Cells in HTML

Styling and Enhancing HTML Tables

To improve the appearance and functionality of your tables, consider adding styles and enhancing them with some features provided by HTML.

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
Responsive HTML Table With Rounded Corners
Responsive HTML Table With Rounded Corners
HTML input types
HTML input types
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
CSS Table Layout
CSS Table Layout
29 Free CSS3 & HTML Table Templates 2026 - Colorlib
29 Free CSS3 & HTML Table Templates 2026 - Colorlib
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
a computer screen with the text html and an image of a web page on it
a computer screen with the text html and an image of a web page on it
Simple Searchable Table In HTML Javascript
Simple Searchable Table In HTML Javascript
Sortable Table with HTML & Javascript
Sortable Table with HTML & Javascript
40 Best CSS Table Templates For Creating Appealing Tables 2026
40 Best CSS Table Templates For Creating Appealing Tables 2026
Quick HTML Tags Cheat Sheet
Quick HTML Tags Cheat Sheet
the table borders for different types of text
the table borders for different types of text
Sortable Table In HTML Javascript
Sortable Table In HTML Javascript
Responsive Table V1 - Free HTML/CSS Table Template 2026 - Colorlib
Responsive Table V1 - Free HTML/CSS Table Template 2026 - Colorlib
a black and orange poster with text that says,'html chat sheet'on it
a black and orange poster with text that says,'html chat sheet'on it
Tables in HTML
Tables in HTML
Responsive HTML CSS Table
Responsive HTML CSS Table
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
Simple Editable Table In HTML Javascript
Simple Editable Table In HTML Javascript

Using the <style> Tag for Basic Styling

Apply some basic styling directly within your HTML using the `