Tables enable you to arrange HTML elements in a grid. Examples of tabular data include calendars, project resource assignments, scientific data sets, and other types of data that make sense to display in rows and columns.

Note

Since tables can arrange HTML elements in a grid, one obvious usage for tables is to define the layout of a web page. This ancient layout technique is now superseded by CSS-based layouts. Many older tutorials still discuss table-based layouts, but for brevity, this tutorial focuses on tables that display tabular data.

When you’re done with this section, you should be able to:

  • Create a basic table with cells containing tabular data
  • Add captions and summaries
  • Change the padding, margins, and borders of table cells using CSS
  • Define more structured tables with column groups, footers, and headers

The Tables chapter contains these sections:

Table Structure

Explains how to construct a simple table by adding rows, columns, and captions.

Cellpadding and Cellspacing

Explains how to control the borders and spacing around table cells using the border, cellpadding, and cellspacing attributes.

Tables and CSS

Explains how to control the borders and spacing around table cells using CSS.

 

See Also