HTML & CSS Course
HTML & CSS
/
Intermediate

Tables

Definition

The `<table>` element represents data in two dimensions (rows and columns).

Explain Like I'm New

HTML's version of an Excel spreadsheet. You create a `<table>`, add Table Rows `<tr>`, and inside those rows you put Table Headers `<th>` or standard Table Data cells `<td>`.

Real World Example

Displaying a financial report, a sports league leaderboard, or a pricing tier comparison chart.

Common Use Cases

  • •Displaying tabular data

Interactive Example

Interview Questions

basic

  • What tags define a row and a cell inside a table?

intermediate

  • Why shouldn't you use tables for website layout?

Flash Cards

Question

Row and cell tags?

Click to reveal answer
Answer

`<tr>` (Table Row) defines the horizontal row. `<td>` (Table Data) defines the individual cell within that row.

Question

Why not use tables for layout?

Click to reveal answer
Answer

In the 1990s, developers used invisible tables to build multi-column website layouts. This is terrible for accessibility (screen readers read it as data, confusing users) and terrible for responsive mobile design. Use CSS Flexbox or Grid for layout, and only use tables for actual tabular data.