
HTML Tips and Techniques
Advanced Table Commands
Once you've got the basics of HTML tables down, it's time to learn some tricks of the trade.
You can do quite a lot to control the formatting of your tables. First, you can set the size of a table. You can do this for an entire table, or just for a certain column. So if you start a table with
<TABLE width=500>
it means the table will only be 500 pixels wide. This gives you space on the side for other content. If you set your very first entry for a given column, you can also force the column to stay wide or narrow.
You can have a given cell align to the left, right or middle with the normal
<TD align="center">
(or left or right)
this will have the text line up in the appropriate spot.
Another good trick is to align the items in the cells to the top, middle or bottom of the cell vertically. This is good if one column has a lot of data in it and you want the other columns to line up with the top end of the cell. You'd do this with valign:
<TD valign="top">
(or middle or bottom)
You can also turn your cells colors! This is pretty if you want to make a header row a different color. You do this with the BGCOLOR command, and you use the hex colors to do this. In fact, the hex color chart uses background colors to turn the various cells their color! You'd do this with:
<TD bgcolor="#CCFFFF">
(or whatever color code you wish)
Enjoy your pretty tables!
Lisa's HTML Tips and Techniques Homepage
Other Sites by Lisa
ASP Code & Help Java Code & Help Gaming Walkthroughs