HTML Table Tips
This page covers:
The 100% width/height Table
Set cellpadding/cellspacing = "0"
Creating Frames with Tables
The 100% width/height Table
This is a method I use when I want to make sure my content is centered
horizontally and vertically. Typically I use it on pages that have a small
center of content. You can create a one cell table with
<TABLE width="100%" and height="100%" border="0">
and set the table cell to vertically and horizontally align the data with
<TD width="100%" valign="middle" align="center">.
Then you can place another table within the cell or just put a picture or some
text or other content.
Set cellpadding/cellspacing = "0"
When you're doing a tight layout using graphics and tables, make sure
to set the cellpadding and cellspacing to "0". If you do not specify the
value for these attributes, they default to "2" and table cell data will not
be able to butt up against each other. For example, if you have a graphic
you've cut up into smaller pieces and need to rebuild it using tables (which
you often have to do with a graphically designed site), you will need to make
sure all the cut up pieces fit tight up against each other. The default
cellpadding and cellspacing will make this impossible so you need to set them
to "0".
Creating Frames with Tables
You can use tables to create a "frame" around a picture by creating
a one cell table with a thick border. Set cellpadding="0"
and cellspacing="0"
and use a thick border (example border="5").
The frame border has a 3D effect and looks like a picture frame.
Next Page: HTML Forms Previous Page: Table Attributes: Spanning Cells
|