Tables - HTML Tutorial
Tables allow you to organize content in a grid of rows and columns. Typical examples of tabular data include calendars, schedules, project assignments, scientific data sets, or any information that is naturally structured in rows and columns.
Note
In the early days of the web, tables were often used to define page layouts. Today, CSS-based layouts (Flexbox, Grid) are the recommended approach. This tutorial focuses on using tables for displaying structured data rather than for layout purposes.
After completing this section, you should be able to:
- Create a basic table with rows and cells containing data
- Add captions and summaries to your tables
- Style tables using CSS to adjust padding, borders, and spacing
- Build more structured tables with headers, footers, and column groups
The Tables chapter includes the following sections:
- Table Structure
-
Learn how to create a simple table, including rows, columns, and captions, while following semantic HTML best practices.
- Cellpadding and Cellspacing
-
Explains the old HTML attributes
cellpaddingandcellspacingand why modern development prefers CSS for controlling cell spacing and borders. - Tables and CSS
-
Demonstrates how to use CSS to style tables, control borders, padding, and spacing, and create visually appealing, responsive tables.
