> Canonical URL: https://codingcat.dev/course/html-for-a-10-year-old/lesson/html-tables

# HTML Tables | HTML for a 10 Year Old | CodingCat.dev Course

[🧶 HTML for a 10 Year Old](/course/html-for-a-10-year-old)Section 1.2 · Lesson 2 of 2[![](/logos/tags/html-symbol-light.svg)![](/logos/tags/html-symbol-dark.svg)HTML](/topic/html)[← Prev Lesson](/course/html-for-a-10-year-old/lesson/html-basics)

# HTML Tables

![CodingCat.dev tutorial cover image](https://cdn.sanity.io/media-libraries/mlttp0BZbCpV/images/9fb6e4347552d8cca0502f8a85cba3f7165bffb1-1921x1080.png?w=1920&q=82&fit=max&auto=format)Lesson 2 / 2Course Lessons Outline▾1Section 1
- [1.1HTML Basics](/course/html-for-a-10-year-old/lesson/html-basics)
- [1.2HTML Tables](/course/html-for-a-10-year-old/lesson/html-tables)

## Full Table Example

Below is an example of the entire table, we will walk through each part and how to create this table.

- `` Defines a table
- `` Defines a header cell in a table
- `` Defines a row in a table
- `` Defines a cell in a table
- `` Defines a table caption
- `` Specifies a group of one or more columns in a table for formatting
- `` Specifies column properties for each column within a `` element
- `` Groups the header content in a table
- `` Groups the body content in a table
- `` Groups the footer content in a table

> Please note if you are new to web development do not use tables for laying out pages. This was something that happened 20 years ago but we have come a long way since then 😉

### Basic Tables

In the most basic example of a table you only need the ``, ``, `` tags. In this example you have a table with a single row (horizontal) and 6 columns (vertical), to show our peeps in a 1×6 configuration.

Copied! 🐾

```

		????
		????
		????
		????
		????
		????

```

If we want a basic table to show our peeps in one column (vertical) with six rows (horizontal) you need to add a `` to surround each ``, to show a 6×1 configuration

Copied! 🐾

```

		????

		????

		????

		????

		????

		????

```

Finally if we need a table with all six columns (vertical) and all six rows (horizontal) it would need to include six `` tags inside of six `` tags.

Copied! 🐾

```

		????
		????
		????
		????
		????
		????

		????
		????
		????
		????
		????
		????

		????
		????
		????
		????
		????
		????

		????
		????
		????
		????
		????
		????

		????
		????
		????
		????
		????
		????

		????
		????
		????
		????
		????
		????

```

Because we are using every cell in the table examples above it makes setting them up very easy. There could be times when you have empty cells requirements. Now you might think that would be easy if you just need two blank cells you remove two of the `` tags. However, the issue is that the browser moves every column to the left (or right if you are in RTL), causing you to actually leave a blank, therefore you need to put in an empty `` element to take up a column worth of space with nothing in it.

Copied! 🐾

```

		????
		????
		????
		????
		????

		????

		????
		????
		????
		????

		????
		????

		????
		????
		????

		????
		????
		????

		????
		????

		????
		????
		????
		????

		????

		????
		????
		????
		????
		????

```

## Live Basic Examples

### The Header

When you see tables in action you often have data that needs to be labeled. The best way to make this happen is by adding a `` element to your table and adding header cells `` to the element to help in labeling this data.

Copied! 🐾

```

			Name

			Purrfect Peeps

			Nick
			????

			AJ
			????
			????
			????
			????
			????
			????

```

Now this simple table setup will work great with a single cell for each column in the first row. But if we add the next row and it has 6 purrfect peeps, we really want to show that the header cell “Purrfect Peeps” is meant for all cells that have emojis.Below you can see the difference between the top table without colspan and with colspan in the second table. Without the colspan the “Purrfect Peeps” cell is taken up by only the cat in the second row, and it does not cover the dog, unicorn, bear, zebra, or otter. In the second table we use “colspan” `Purrfect Peeps` to tell the browser that this header should span all 6 columns, notice how all the cells center under the heading.

### Nested Table

There is a great deal of power that you can add to your tables by nesting an entire table into a cell. I often forget to wrap this with a `` tag so please don’t just try to add rows `` within a `` tag and think this will work, it needs to be represented by an entire table. As you can see below we have added social links as an entire table within a cell.

Copied! 🐾

```

				[Twitter]()

				[LinkedIn]()

```

Below you can start to see that the parent header row “Socials” still represents all data in the cell, even the nested table in the second row with a 4×4 table.

### Column Group

The column group tag `` can be used for styling entire columns at a time, instead of having to update each cell individually. Something that you will often see is a single column highlighted. This provides a valuable tool that is a common use case for highlighting an entire column. By this simple code snippet we can highlight the socials to include a background of pink.

Copied! 🐾

```

```

### Footer

A very common use case for a footer and the reason for calling it out separately is to include Totals or Aggregations (fancy math like word for adding stuff). In this example we just add some text with fun phrase.

Copied! 🐾

```

		AJ's Peep List! This is an example of a unique footer area.

```

> Pro Tip: by keeping a seperate header and footer tag it allows large table body content to be easily scrolled while the header and footer maintain in place.

### Caption

> By default, a table caption will be center-aligned above a table. However, the CSS properties text-align and caption-side can be used to align and place the caption. -W3 Schools

I find myself using caption less and less over other methods, but I thought it would be a nice complete example. Adding the below snippet with an attribute text-align=”bottom” will place example text below our table. This could explain some of the figures or label your table.

Copied! 🐾

```

	This is an example caption for our table.

```

✏️ Visual Architecture Diagram

## how this course connects together.

Follow AJ through the layered stack topology from input contract to production output.

Let’s build it!✏️ Architecture Diagram: HTML for a 10 Year Old: HTML TablesLAYERED SYSTEM STACKARCHITECTURE DIAGRAM[Diagram Walkthrough]Content-driven layered-stack diagram for HTML for a 10 Year Old: HTML Tables: Section 1 -> HTML for a 10 Year Old -> Verified Production Artifact.AAA Contrast Verified

## related deep dives.

[View All&rarr;](/blog)[![The Odin Project 5: Advanced HTML, CSS View Transitions & WCAG Accessibility](https://cdn.sanity.io/images/hfh83o0w/production/93736ccee5b8c088a202f319ce1223899a41f6bf-1376x768.png?w=1376&q=82&fit=max&auto=format)](/course/odin-advanced-html-css-and-a11y)November 4, 2026[![](/logos/tags/css-symbol-light.svg)![](/logos/tags/css-symbol-dark.svg)CSS](/topic/css)[#Accessibility](/topic/a11y)[![](/logos/tags/html-symbol-light.svg)![](/logos/tags/html-symbol-dark.svg)HTML](/topic/html)[+1](/course/odin-advanced-html-css-and-a11y)

### [The Odin Project 5: Advanced HTML, CSS View Transitions & WCAG Accessibility](/course/odin-advanced-html-css-and-a11y)

Build 60fps GPU-accelerated animations, multi-page Astro View Transitions, WCAG AAA focus rings, and accessible native <dialog> and Popover components.

[![Alex Patterson](https://cdn.sanity.io/media-libraries/mlttp0BZbCpV/images/a606dfaa381aab08ddbe16a33fe1d3e1fb37c927-400x400.jpg?w=96&h=96&q=82&fit=max&auto=format)Alex Patterson](/author/alex-patterson)[![The Odin Project 3: Intermediate HTML, Modern Forms & CSS Grid Architecture](https://cdn.sanity.io/images/hfh83o0w/production/e81cb7bdd395cf1351722a2e6357da97cc3c1ed6-1376x768.png?w=1376&q=82&fit=max&auto=format)](/course/odin-intermediate-html-and-css-grid)November 4, 2026[![](/logos/tags/css-symbol-light.svg)![](/logos/tags/css-symbol-dark.svg)CSS](/topic/css)[![](/logos/tags/html-symbol-light.svg)![](/logos/tags/html-symbol-dark.svg)HTML](/topic/html)[#Design](/topic/design)[+1](/course/odin-intermediate-html-and-css-grid)

### [The Odin Project 3: Intermediate HTML, Modern Forms & CSS Grid Architecture](/course/odin-intermediate-html-and-css-grid)

Master 2D CSS Grid layouts, Subgrid, CSS Custom Properties, fluid clamp() typography, container queries, and zero-JS form validation with :user-valid.

[![Alex Patterson](https://cdn.sanity.io/media-libraries/mlttp0BZbCpV/images/a606dfaa381aab08ddbe16a33fe1d3e1fb37c927-400x400.jpg?w=96&h=96&q=82&fit=max&auto=format)Alex Patterson](/author/alex-patterson)[Course Outline](/course/html-for-a-10-year-old)

## HTML for a 10 Year Old

2/21

### Section 1

- [1.1HTML Basics](/course/html-for-a-10-year-old/lesson/html-basics)
- [1.2HTML Tables▶](/course/html-for-a-10-year-old/lesson/html-tables)

@CodingCatDev on YouTube62.5K / 100K

Subscribe for new course lessons and architecture deep dives every week.

[Subscribe for New Lessons →](https://www.youtube.com/@codingcatdev?sub_confirmation=1)