HTML and CSS Reference
This code results in a table that looks like the one in Figure 10-1.
Figure 10-1. Basic, unstyled table using almost exclusivey tr and td elements
As you may have noticed, the (X)HTML for this table is almost exclusively tr and td ele-
ments. These are the building blocks of most (X)HTML tables, but they are only the beginning
of the host of table-related elements and attributes (X)HTML provides. Now we'll explore all
the other exciting table-related elements you have at your disposal.
The caption Element
By adding a caption element immediately after the opening <table> tag, you can provide
a name or short description of your table. While this is not required, it's a good practice that
adds extra context and meaning to your table. A caption element for our example table would
look like this:
<caption>Pro CSS Techniques authors</caption>
Note that while the caption element belongs at the top of your table, it does not have to
be displayed there. CSS offers a property for placement of the caption, which we'll discuss
later in the chapter.