Now we're getting somewhere - tables!
Back in the day I didn't appreciate tables. I thought that they would merely be a way for
companies to put their catalogs onto the web in an organized fashion, and I didn't think
they were neat. Gradually over time, I realized that there are some exceedingly practical
uses for tables, and I have warmed to them. But there is a price to pay, and that price
is some mildly complex and confusing HTML.
You should be aware that the way most people use tables is a gross abuse of their intended purpose.
Tables were never intended as a tricky way to do complex page layouts. They were created for the
presentation of tabular data. Most people ignore this. Hopefully, the eventual dominance of style
sheets will take over as a layout technique and tables can go back to their original purpose.
Before you get started, you may want to check out some documentation on tables:
The thing you have to get a handle on right off the bat with tables is visualizing the layout of your data
as rows and columns. Draw a sketch of what you want your page to look like. Get a clear picture in your mind,
and then try to do the formatting. It will be much harder if you haven't mapped it out on paper ahead of time.
The basic components of tables are rows and data cells. A row extends horizontally across
the page. Within a row are any number of individual cells, which can contain any kind of HTML that you want. A good place
to start with the programming of a table is to determine how many rows you will need. The next thing to figure out is whether
you have data cells with will span across rows or columns. Once you've figured out these basic elements, you can begin to
layout your table.
| |
This is a cell
that spans two rows.
|
Aren't tables
|
|
| fun?
|
| |
Things to notice about tables:
- Data cells always have to have something in them. Use a spacer gif or the " " character.
- Rows are as high as the highest data cell.
- The spec doesn't require you to close tr elements. Older versions of Netscape will balk if you don't.
Tables are most useful to ensure that your content appears on the screen with the formatting you intend. By this I mean,
you can use a table to specify an exact width or height. Thus, your elements will always appear in the same orientation
regardless of the width of a user's browser. Try opening Netscape very wide on a computer with a very large monitor and
examine some sites that don't use tables and check out what happens.
Here are a few sites which illustrate the effective (abusive) use of tables:
Building Web Sites - ITP Fall 2000 - Mike Cosaboom, Instructor
mc39@acf2.nyu.edu