Why use a table?

Sometimes you want to arrange things side by side.
The browser wants to throw everything against the left edge of the screen.

words in the middle

in the example above i have 3 objects spaced apart from each other.. the only way to do this is either to put lots of blank spaces in between (bad idea!) with the special character   or put them in a table (good idea!)

  • you can add separate background colors to different areas of the screen.
  • tables can shrink and grow with the screen size if you use percentages intead of absolute pixels to define the size.
  • table borders can be visible or invisible

 

Tables: Sometimes, as in the example above, you may want to line things up side by side. This requires the use of a table.

the table above has border=0 this table has border=1
the table above has one row this table has 3 rows
the table above is width=95% this table is width=15% and align=left

a table can be aligned to the left or right of the screen, it can have a width expressed either as an exact number of pixels or as a percentage of the screen.

the tags used to make a table are:

<table> to start it and </table> to end it
<tr> to start a table row, </tr> to end row
<td> to mark each piece of table data, </td> to end data

view the source code of this page to see how the tags work!

see this same page with visible table borders