|
Setting the Width
A browser will automatically determine the width of your table by calculating the width of the elements and text it contains. Somehow, it always seems to add a little extra. Its particularly important to manually set the width of each cell and of the table as a whole in order to eliminate this extra space.
To set the width of a cell or table:
In the TD or TABLE tag, type WIDTH=n, where n is the desired width of the cell or of the entire table, in pixels.
Tips
- You can also set the size of a cell or table as a percentage of the table or browser, respectively. The table will expand as the browser window is resized.
- You cant make the table too small for its contents; the browser will just ignore you.
- The width of the table should be the sum of the width of the columns and their elements, the width of the border (see page 146), and the width of the cell spacing and cell padding (see page 155).
- There is also a HEIGHT tag but it is non-standard, and not very well supported.
- Generally, you only need to use the WIDTH tag with the first cell in each column. However, if you have cells that span columns or rows (see pages 152153), it may be necessary to add the WIDTH attribute explicitly to every cell.
- If you make the table wider than the browsers window, the visitor may not be able to see the parts of the table that extend off to the right. I dont recommend making tables any wider than 600 pixels.
|
|
|
|
|