<<< HOME

USING TABLES TO DESIGN A WEB PAGE

You don't need to use tables to design your pages, but the alternative is to have your text in one big clump with a right, left or (the choice of amateurs) in the center. TABLES provide a framework to hang your objects (meaning here text strings and images) all across the page. Tables, with their built-in attribute of "cellpadding" offer an easy way to control text margins.

WHAT ARE THE PARTS OF A TABLE?

    There are 3 tags needed to make up a table, and all can carry attributes separately:
  • There is the table tag itself, <table></table>, which announces to the browser that a table exists.
  • There is the tag that announces a table row, <tr></tr>; you can't have cells without a table row.
  • Then there is the cell tag, <td></td> (careful: "td" means "table data"); your stuff goes between these two tags.

WHAT FORMATTING CAN I ASK FOR IN THE TABLE TAG?

In part, you can ask for the following attributes within the table tag (right click in Dreamweaver):

  • cellpadding = "x" (no. of pixels) -- space left around content in each cell.
  • cellspacing = "x" (no. of pixels) -- space between cell walls.
  • border = "x" (no. of pixels) -- adds a border between all cells and around table.
  • width = "xxx" (no. of pixels) -- gives a precise minimum width to table (can be blown out).
  • align = "position..." (left, center, right) -- positions whole table on page.
  • bgcolor = "#ff0000" (hexidecimal color ref.) -- changes background color of whole table.
  • background = "images/yourbkgd.gif" -- includes background image of your choice for whole table.

CAN I GET THE SAME STUFF IN A CELL TAG?

Yeah, pretty much, you can. Can't get cellpadding, cellspacing or border, though. You can code attributes into table rows, too, but mostly you want to work with table and cell attributes.

 

BACKGROUNDS

You can choose your own background colors and images for the page body, any table and any cell by invoking an attribute, either "bgcolor" or "background". A backgroun color is easy to use, and a great tool. Putting in a background image is a bit trickier:

    On the plus side of using backgrounds
  • Backgrounds "tile" to fill whatever area there is.
  • You can use text or other images over backgrounds.
    On the down side of using backgrounds
  • Backgrounds "tile" to fill whatever area there is.
  • They must be sized outside HTML, and even then, you may get "unpredictable" results.

 

SEE BACKGROUND USAGES••>

SEE CHECKERBOARD AS BACKGROUND ••>

 

BTW: WRITING INVISIBLE COMMENTS

This is an "Oh, by the way … If you bracket anything with these halves of a tag < ! - - and - - > , everything in between is "commented out" and will not be seen by the browser. If you want to write notes on your pages for reference purposes, just put them between the halves of the comment tag. NOTE: Anyone who uses "View Source" on a browser can see what you've written on your page, so don't get too cute.