Build clear, accessible, and SEO-friendly tables using <table>, <thead>,
<tbody>, <th> and <td>. This lesson covers structure,
styling basics, accessibility, and real business examples (invoices, pricing, and rosters) with ready-to-copy code.
1. Why structure matters (search & users)
Properly structured tables are easier for humans, search engines, and assistive technologies to understand.
Use <thead> for column headers, <tbody> for the data rows, and optionally
<tfoot> for summaries. Semantic structure improves:
Search indexing — tables with clear headings are more understandable for search engines.
Accessibility — screen readers announce headers and allow navigation by row/column.
Maintainability — clean structure separates concerns: data vs presentation.
2. HTML table anatomy — tags and roles
Core tags and what each does:
<table> — container for the table.
<caption> — short description (optional but helpful for accessibility).
<thead> — groups header rows.
<tbody> — groups body/data rows.
<tfoot> — groups footer rows (summaries, totals).
<tr> — table row.
<th> — header cell (use scope attribute).
<td> — data cell.
<colgroup> / <col> — define column-level styling or widths.
3. Real business examples (copy & reuse)
Below are three real-life business scenarios with clean, copyable code. Each example uses semantic table structure so it’s search-friendly and accessible.
A. Simple Invoice (sales / billing)
Use tables for invoices and order summaries. Include a <caption> and <tfoot> for totals.
SEO idea: Pricing tables often rank in search for queries like “best X plan for Y”. Use descriptive captions and headings to help search engines understand the table content.
C. Employee roster / contact list
Keep contact lists tabular for readability. Use scope="row" on row headers for better accessibility.
Write a clear, short caption that contains descriptive keywords (what users search for).
Surround tables with meaningful header text (H2/H3) describing the table content — search engines use these.
If the table answers a specific query (e.g., “monthly plans comparison”), include that phrase in the page title and caption.
Use structured data when appropriate (e.g., Product or FAQ schemas) — this may increase visibility in search features.
9. Summary
A well-structured table helps users, accessibility tools, and search engines alike. Use semantic tags
(<thead>, <tbody>, <tfoot>, and scope on headers),
style simply, and keep mobile users in mind with responsive wrappers. For business needs — invoices, pricing,
and rosters — the pattern is the same: clear caption, headers, data rows, and a footer for totals or notes.
✅ Copy one of the examples into your CMS HTML block and adapt the columns — that alone will fix most table-related problems.