The Art of Building Tables -
Part III
by Thomas Brunt OutFront News Article: November 29, 2000
Forcing Cell Widths
Sometimes you don’t need to be exact to the pixel on
cell/column widths. It’s fine to just declare cell
widths in such cases. If you need to be precise,
however, just declaring pixel widths in the cell
properties dialog is not enough. That usually does fine
in IE but often not in Netscape 3 and 4. The table will
be the right width in Netscape, but some columns will
be a bit wider than they’re supposed to be and others
will be a bit narrower than they’re supposed to be.
You have to put something into each column to force the
column out to the width you need.
For precise tables, I start with a table that has
cellpadding of 0 and cellspacing of 0. If I need to
create the effect of padding, I just create spacer
cells for that. The key to forcing the cells to the
proper width is to create an extra row at the bottom of
your table. I insert into each of the cells on that
bottom row a 1 pix by 1 pix clear gif image. Then, I go
into the source code and change the width attribute to
equal the width of the cell/column.
If you don’t know how to make a cleardot gif, I have
one you can take at the following url. Just right click
inside the box and select “save picture as.” http://www.outfront.net/cleardot.htm
In this case the 150 wide cell is to allow for a
navigation bar column. Each of the 10 wide cells are
spacer columns that act like cellpadding. The 420 wide
cell is for the primary content column of the page.
I also like to put these clear gifs into any empty
table cells I have because many versions of Netscape will not display a
cell’s background color unless there is something in
that cell. Some folks put nonbreaking spaces (spacebar)
in empty cells. FrontPage often does this by default,
but that forces the cell out to at least the width of
the nonbreaking space. Sometimes I don’t want the
cell to be that wide or that tall.
Thomas Brunt
OutFront.net
A Microsoft FrontPage Learning Community