Course contentsShow
← Web Development
Lesson 111 of 2,9822. HTML FundamentalsFree lesson

Table Structure: <table>, <tr>, <td>

Learn the basic table elements: table container, rows, and data cells.

What You'll Learn

You'll learn how to create a basic HTML table using the three essential building blocks: <table>, <tr>, and <td>.

Understanding HTML Tables

Think of an HTML table like a spreadsheet or a simple grid. Just as a spreadsheet organizes information into rows and columns, HTML tables do the same thing on web pages. They're perfect for displaying structured data like schedules, price lists, or comparison charts.

The Three Core Elements

The <table> Element
This is your container—it wraps everything and tells the browser "I'm about to show you a table." Without this outer wrapper, you can't have a table.

The <tr> Element
TR stands for "table row." Each <tr> element creates a horizontal row across your table. If you want three rows of data, you'll have three <tr> elements inside your <table>.

The <td> Element
TD stands for "table data." These are the actual cells that hold your content. Each <td> sits inside a <tr> and creates one cell in that row. If you put three <td> elements in a row, you'll get three columns.

How They Work Together

Imagine building with blocks: First you place the big <table> box. Inside it, you stack <tr> shelves horizontally (your rows). On each shelf, you line up <td> boxes side-by-side (your cells). Each <td> can contain text, numbers, or other content.

The structure always follows this nesting pattern:

  • <table> contains one or more <tr>
  • Each <tr> contains one or more <td>
  • Each <td> contains your actual content

Key Takeaway: HTML tables require three elements working together—<table> as the container, <tr> for each row, and <td> for each data cell within those rows.