Tables: HTML
The Basic Table
To create a table using HTML:
|
||||||||||||
|
NOTE: TR stands for Table Row | |||||||||||
|
NOTE: TD stands for Table Data | |||||||||||
|
NOTE: TH stands for Table Header | |||||||||||
| Example | Thus if I want to create a simple table with two rows and five columns, the HTML would be: | |||||||||||
|
||||||||||||
| Here is the table resulting from the above code: | ||||||||||||
|
||||||||||||
| Align the Table | You can center the table on the screen by placing the <CENTER></CENTER> tags before and after the <TABLE></TABLE> tags. | |||||||||||
| Adjust the Width and Border | To adjust the width of the table on the
screen, use the attribute WIDTH="%" where % is the per cent
of the screen width taken up by the table.
To change the size of the border around the table use BORDER="n" where "n" is the width in pixels. To create a borderless table set the value of n to 0. In the table below the width of the table has been adjusted and the border has been increased. <TABLE WIDTH=55% BORDER=5> |
|||||||||||
|
||||||||||||
| Adjust the Space Between Cells | To change the amount of space (in pixels)
between table columns, use the CELLSPACING="n" attribute in
the initial <TABLE> tag.
Here is our table with the CELLSPACING tag: |
|||||||||||
|
<TABLE WIDTH=55% CELLSPACING=3 BORDER=3> |
||||||||||||
|
||||||||||||
| Adjust the Space Within Cells | To change the amount of space (in pixels)
between the cell data and the cell walls, use the CELLPADDING="n"
attribute in the initial <TABLE> tag.
Here is our table with the CELLPADDING tag: |
|||||||||||
|
<TABLE WIDTH=55% CELLPADDING=3 BORDER=3> |
||||||||||||
|
||||||||||||
Tables: HTML
Overview
The Basic Table
Table Cell Attributes
Advanced Table Design
Web Design Center
Last Revised:
October 19, 2006
© Agatha Taormina