Tables

Syntax:


The <TABLE> tag


Common Tag Attributes

There are several attributes that are common to multiple table tags. When applied to a lower level tag, these attributes override the settings at higher levels. For example:

Attributes
ALIGN Sets horizontal alignment of the contents within a cell to 
  • LEFT
  • CENTER
  • RIGHT
VALIGN Sets vertical alignment of the contents within a cell to 
  • TOP
  • MIDDLE
  • BOTTOM
COLSPAN Specifies the number of columns the cell spans
ROWSPAN Specifies the number of rows the cell spans
BACKGROUND Specifies the URL of a background image
BGCOLOR Specifies the background color


Other Attributes of the <TABLE> tag


The Table Caption


The Table Header


The Table Row


The Table Cell


What Can Go in a Table Cell

The following HTML elements can be placed in a table
Text Text is the most obvious element that can be placed in a table cell. All text formatting tags can also be included, for example
  • physical and logical styles
  • heading styles
  • font formatting
  • list formatting
  • line and paragraph breaks
  • hypertext anchors
Images An image can be placed in a table cell by putting the <IMG> tag between the <TD> and </TD> tags that define the cell. This is the best way to get an image centered on the page.
Blank
Space
Sometimes you will want to leave a cell blank. This can be done by not putting anything in the cell defining tags. However, if you have the border turned on, it will usually be more desirable to use a non-breaking space, as in
    <TD>&nbsp;</TD>
Form
Fields
Form Fields are often unattractive because it is impossible to align them. This problem can be easily solved by placing them in a table.
Other
Tables
You can nest a table in a cell of another table. This is how much of the columnar text formatting found in this section was accomplished. Prior to the HTML 3.2 standard, only Netscape Navigator and Microsoft Internet Explorer supported nested tables.


Example


The Table as a Design Tool


Frames


FRAMESET

Syntax:


FRAME

Syntax:


Targets

Syntax:


Noframes

Syntax: