HTML and CSS Reference
In-Depth Information
The Headers Attribute
The
headers
attribute is very similar to the
scope
attribute. By default, the
scope
attribute may only be used on the
<th>
element. In the case that a cell,
either a
<td>
or
<th>
element, needs to be associated with a different header,
the
headers
attribute comes into play. The value of the
headers
attribute on a
<td>
or
<th>
element needs to match the
id
attribute value of the
<th>
ele-
ment that cell pertains to.
Table Structure
Knowing how to build a table and arrange data is extremely powerful; however, there are
a few additional elements to help us organize the data and structure of a table. These ele-
ments include
<caption>
,
<thead>
,
<tbody>
, and
<tfoot>
.
Table Caption
The
<caption>
element provides a caption or title for a table. A caption will help users
identify what the table pertains to and what data they can expect to find within it. The
<caption>
element must come immediately after the opening
<table>
tag, and it is
positioned at the top of a table by default (see
Figure 11.3
)
.
1.
<table>
2.
<caption>Design and Front-End Development Books</caption>
3.
...
4.
</table>
Figure 11.3
A table of topics with a caption that shows what the table relates to
Search WWH ::
Custom Search