Chapter 9 of 17 · HTML for Beginners — Complete Free Tutorial
HTML Tables
Tables display tabular data — information with rows and columns. Modern HTML gives tables powerful structure for both browsers and screen readers, and the most common beginner error is using tables for page layout (please don't).
Table anatomy
<table>
<caption>Scriptly course pricing (2026)</caption>
<thead>
<tr>
<th scope="col">Course</th>
<th scope="col">Duration</th>
<th scope="col">Price (₹)</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">HTML Essentials</th>
<td>3 weeks</td>
<td>Free</td>
</tr>
<tr>
<th scope="row">Frontend Bootcamp</th>
<td>12 weeks</td>
<td>7,999</td>
</tr>
</tbody>
<tfoot>
<tr>
<th scope="row">Bundle</th>
<td>15 weeks</td>
<td>8,999</td>
</tr>
</tfoot>
</table>
Expected output: a titled table with a bold header row (Course / Duration / Price), two data rows, and a footer row.
The building blocks
| Element | Role |
|---|---|
<table> | Wraps the whole table |
<caption> | The table's title — the first child, read by screen readers |
<thead>, <tbody>, <tfoot> | Group header, data, and summary rows |
<tr> | A row |
<th> | Header cell (bold + scoped) — use scope="col" or scope="row" |
<td> | Data cell |
scope: the accessibility hero
scope="col" tells a screen reader "this header describes the column below"; scope="row" says "this header describes the row beside it". Without it, a blind user navigating cell-by-cell hears numbers with no idea what they mean.
Merging cells
<!-- colspan: one cell spans columns -->
<tr>
<td colspan="2">All prices include lifetime access</td>
</tr>
<!-- rowspan: one cell spans rows -->
<tr>
<td rowspan="2">Weekend batch</td>
<td>Saturday</td>
</tr>
<tr>
<td>Sunday</td>
</tr>
Golden rule: a table with merged cells must still be read logically — test by outlining it on paper first.
Making tables responsive
Wide tables overflow on phones. Three proven strategies:
- Wrapper + horizontal scroll (simplest): wrap the
<table>in<div class="overflow-x-auto">. - Stacked layout with CSS: below 640 px, make each row a card and each cell show its header via
data-label. - Split the data — sometimes two simpler tables beat one complex one.
Real-life use case
A pricing page comparison table: <caption> names the plans, <th scope="col"> headers name the features, <th scope="row"> headers name each feature row, and a <tfoot> row shows "Billed annually". Search engines can also parse table data into rich results.
Common mistakes
- Layout tables — using
<table>to place a sidebar next to content. This was standard in 2003; CSS layout (semantic HTML5) replaced it decades ago. - Skipping
<caption>— a table without a title is context-free. - Missing
scopeon header cells. - Empty cells for spacing — use CSS borders/gaps instead.
- Nested tables — a performance and maintainability nightmare; avoid entirely.
Best practices
- Keep tables simple: header row + data rows covers 90% of cases.
- Use
<tfoot>even when it visually appears last — screen readers announce totals properly. - Add a visible caption or an
aria-labelon the wrapper for scrollable tables.
What's next?
Capture user input with Forms & Inputs — the most involved chapter in the series — or structure whole pages with Semantic HTML5.
Frequently Asked Questions
HTML (HyperText Markup Language) is the standard markup language that defines the structure and meaning of every web page. Learning HTML is the fastest way into web development: it is the foundation that CSS, JavaScript, and every framework build upon, and it directly affects SEO and accessibility.
Most beginners can build their first complete page in a day and become comfortable with the core tags within 1–2 weeks of daily practice. This 17-chapter series is designed to be completed in about 2–3 weeks at a relaxed pace, faster if you type out every example.
Only a plain text editor (VS Code is free and popular) and a web browser. No installation, no setup, no account — create a file called index.html, double-click it, and it opens in your browser.
HTML5 is the current generation of the HTML standard (published as the living standard by WHATWG). When people say "HTML5" they usually mean modern HTML: semantic elements like header, nav and article, native audio/video, canvas, and improved form input types — all covered in this tutorial.
No. HTML is a markup language — it describes content and structure but has no variables, loops, or conditionals. Those come with programming languages like JavaScript, which you would learn after HTML and CSS.
Right here: every chapter includes examples you can retype in your own index.html file, plus practice challenges. After this series, build small projects — a portfolio page, a recipe page, or a landing page for a local business — they exercise the same tags in real contexts.
Search engines crawl HTML first. Unique titles, a single clear h1, a logical heading hierarchy, descriptive alt text, valid markup, fast-loading responsive images, and a proper internal linking structure all come straight from HTML — see the HTML & SEO chapter for the full checklist.
Accessible HTML makes your site usable by everyone, including people who rely on screen readers or keyboards, and it is a legal requirement in many countries. The good news: proper labels, semantic elements, alt text, and keyboard-operable controls are mostly free HTML habits.
No — there are roughly 100 meaningful tags and you will naturally use about 30 of them regularly. Focus on understanding purpose and structure; editors and references (like MDN) handle the rest. This tutorial covers every tag beginners actually need.
CSS for visual design and layout, then JavaScript for interactivity, then a version control system (Git). With those three you can build complete websites; frameworks like React or Laravel Blade come after the fundamentals feel natural.