ptg16476052
242 LESSON 10: Building Tables
Creating Tables
Creating tables in HTML is a degree more complex than anything you’ve seen so far
in this book. Think about how many different types of tables there are. A table can be
a three-by-three grid with labels across the top, or two side-by-side cells, or a complex
Excel spreadsheet that comprises many rows and columns of various sizes. Representing
tables in HTML is heavy on tags, and the tags can be hard to keep track of when you get
going.
The basic approach with table creation is that you represent tabular data in a linear fash-
ion, specifying what data goes in which table cells using HTML tags. In HTML, tables
are created from left to right and top to bottom. You start by creating the upper-left cell
and finish with the bottom-right cell. This will all become clearer when you see some
actual table code.
Table Parts
Before getting into the actual HTML code to create a table, here are some table-related
terms you’ll see throughout this lesson:
n The caption indicates what the table is about: for example, “Voting Statistics,
1950–1994,” or “Toy Distribution Per Room at 1564 Elm St.” Captions are
optional.
n The table headings label the rows, columns, or both. Usually they’re in an empha-
sized font that’s different from the rest of the table. They’re optional.
n Table cells are the individual squares in the table. A cell can contain normal table
data or a table heading.
n Table data is the values in the table itself. The combination of the table headings
and table data makes up the sum of the table.
Figure 10.1 shows a typical table and its parts.
FIGURE 10.1
The elements that
make up a table.