Page 19 of 23PREVNEXT

HTML Tables II: Table and cell widths

Although you can't see it, there's a spacer GIF that's keeping the left column propped open to 100 pixels. The right column has 100% width, so it fills the available space in the browser window.

We just showed you a reason to use spacer GIFs within a traditional table of data. However, spacer GIFs are also used when designing a page layout using HTML tables. Specifically, you can use a spacer GIF when you need to keep one column at a fixed width, and another at a percentage width.

Click the Play button on the left to see an animated example. Notice the following:

  • The left column is fixed at 100 pixels. It contains a spacer GIF that's sized to 100 pixels—to keep the column from collapsing.
  • The right column has a width of 100%, and stretches into the available space in the browser window.

This kind of table is often referred to as a "hybrid" table because of the two different widths (pixel and percentage) used.

Page 19 of 23PREVNEXT