47
13
Cells are defined by TD (table data) and TH (table header) tags.
The original purpose of the distinction between TH and TD tags seems to have been to mark a
difference in the type of information in the cells so that the different types of cells could be
rendered differently.
Table cells may contain two types of information: header
information and data. This distinction enables user agents to
render header and data cells distinctly, even in the absence of
style sheets. For example, visual user agents may present header
cell text with a bold font. Speech synthesizers may render header
information with a distinct voice inflection.
The HTML specification never defines the terms "header information" and "data". Perhaps we
can say that what distinguishes header information from data is that a header can "stand by itself"
as a piece of information (the name of a category) but that data cannot stand by itself in the same
way — it requires some
metadata
contained in one or more header cells. Consider the number
4.5, for instance. It is a piece of data, to be sure. But we have no idea what it
means
until we can
associate it with some metadata. Is it the unemployment rate for Chicago in June, 1999? The
amount of raw titanium ore refined in Uganda in 1988, measured in units of one hundred
thousand tons? Russia's average annual gross national product between 1999 and 2001, measured
in units of a quadrillion rubles? A percent change in the Consumer Price Index for last month?
Without any metadata, we can't tell.
The essential nature of a data cell, then, is that it cannot stand alone. It must be associated with
metadata in one or more header cells to be meaningful. It follows that an essential adjunct of the
distinction between data cells and header cells is some notion of a link (connection, association)
between a data cell and the header cells that make it meaningful. It is not enough for HTML to
provide a way to distinguish data cells from header cells — it must also provide a way to
associate a data cell with its header cells.
In a visual browser, this is generally not a problem. When the header cells are enclosed in TH
tags and rendered in bold, a sighted user can easily make the connection. He simply looks
upward from the data cell to find the bolded cells above it, and he looks left from the data cell to
find the bolded cells to its left. Those are the header cells associated with the data cell.
A non-sighted user, on the other hand cannot do this. So in order to support non-sighted users
using screen readers, HTML must provide some method that a screen reader can use. We will
discuss those features in the section on associating data cells with header cells
. But first, let's
finish our discussion of data and header cells by making a couple of points.
1. The W3C intended TH cells to be used to contain header information, and TD cells to be
used to contain data. For cells that need to act as both data and header cells, TD should be
used.
along with either the HEADERS or SCOPE algorithm (which we will describe
shortly), or AXIS. The HTML language specification gives this example
of a table where
the row headers are marked up using the TD tag.