The Comprehensive HTML Cross Reference


Tables Tags

This document describes tags used in tables.

Click here to skip over the explanatory material at the top of the page and jump straight to the tags.

This table:

Support: HTML:2.0, 3.0, 3.2  Netscape:1.1+  MS Explorer:1.0+
and these icons:
(HTML 3.0 Only) (HTML 3.2 Only) (Netscape Extension) (Microsoft Extension) (Microsoft Extension 3.0)

alert you to tags and attributes that are not supported by all browsers. The support page explains the table and the icons in detail.

CDI Home Page

Finding your way around...

Not all HTML tags are in this single file. The comprehensive list has been split into the following eight categories:

We have also provided several indexes to help you navigate through this reference. In addition to our main indexes (the compact index and the complete index), there are four other indexes that list the tags according to the standards and browsers that support them.

CDI Home Page

The Comprehensive HTML Cross Reference was created as a service to the Internet community. It represents a joint effort of Scott Williams of CDI Corporate Education Services and Kate Gregory of Gregory Consulting and is fully protected by Copyright © 1995 - 2001. Please report any errors or omissions to Kate Gregory.

CDI Home Page

Caption
Support: HTML:3.2 Netscape:2.0+ MS Explorer:3.0+


<CAPTION> text </CAPTION>
(Netscape Extension)
(HTML 3.2 Only) <CAPTION ALIGN=alignment> text </CAPTION>
(Microsoft Extension) <CAPTION ALIGN=
alignment> text </CAPTION>
(Microsoft Extension) <CAPTION VALIGN=
vertical-alignment> text </CAPTION>

The caption tag defines the caption of a figure or table. It is valid only within FIG or TABLE tags.

(Netscape Extension) (HTML 3.2 Only) The ALIGN attribute arranges for the caption to be at the TOP or BOTTOM of the table or figure.

(Microsoft Extension) The ALIGN attribute sets the alignment of the caption within the table or figure border. It can be LEFT, RIGHT, or CENTER.

(Microsoft Extension) The VALIGN attribute arranges for the caption to be at the TOP or BOTTOM of the table or figure.

CDI Home Page

Multi Column Text
Support: HTML:No Support Netscape:3.0+ MS Explorer:No Support


<MULTICOL attributes>

This tag is a container, used to split the display into columns without using frames or tables. The attributes of this tag are:

COLS="number"
The COLS attribute is mandatory and controls how many columns the display will be split into.
 
GUTTER="pixels"
The GUTTER attribute controls the pixels of space between columns. It defaults to a value of 10.
 
WIDTH="number"
The WIDTH attribute controls the width of an individual column.

CDI Home Page

Table
Support: HTML:3.2 Netscape:1.1+ MS Explorer:2.0+


<TABLE attributes> table-content </TABLE>

A table consists of an optional caption (CAPTION) and one or more rows (TR.) The attributes are:

ALIGN="alignment"
This causes the table to be aligned in one of a variety of ways on the page. Here "alignment" should be one of
  • LEFT: To the left text margin
  • CENTER: In the centre of the page (Turns on NOFLOW.)
  • RIGHT: To the right text margin
  • (HTML 3.0 Only) BLEEDRIGHT: To the rightmost edge of the window
  • (HTML 3.0 Only) BLEEDLEFT: To the leftmost edge of the window
  • (HTML 3.0 Only) JUSTIFY: To both text margins (The table size is adjusted. Turns on NOFLOW.)
  • Note that this does not affect the alignment of the table entries.

    WIDTH=number
    The UNITS attribute is used to translate number.
    BORDER
    This attribute causes the table to be drawn with a border.
    BORDER=number
    This attribute draws the table with a border number pixels thick.
    CELLPADDING=number
    This separates the cell borders and the text with a padding of number pixels.
    CELLSPACING=number
    This separates cells with a gutter of number pixels.
    (Microsoft Extension)(Netscape Extension)BGCOLOR="#rrggbb"
    BGCOLOR="colorname"
    This attribute sets the background colour for the entire table.
    (Microsoft Extension)BORDERCOLOR="#rrggbb"
    BORDERCOLOR="colorname"
    This attribute sets the border colour for the entire table.
    (Microsoft Extension)BORDERCOLORLIGHT="#rrggbb"
    BORDERCOLORLIGHT="colorname"
    This attribute sets the border highlight colour for the entire table.
    (Microsoft Extension)BORDERCOLORDARK="#rrggbb"
    BORDERCOLORDARK="colorname"
    This attribute sets the border shadow colour for the entire table.
    (Microsoft Extension)VALIGN="valign"
    This attribute sets the vertical alignment for the entire table. "valign"is TOP or BOTTOM.
    (HTML 3.0 Only) CLEAR=clear
    Here "clear" should be one of LEFT, RIGHT, or ALL and specifies which margin should be clear.
    (HTML 3.0 Only) NOFLOW
    This attribute prevents text flow around the table and is equivalent to setting the CLEAR attribute on the element after the table.
    (HTML 3.0 Only) COLSPEC=colspec
    Here colspec is a list of column alignments and widths, separated by spaces. There should be one entry for each column in the table, and each should be an optional capital letter for alignment (one of L (left,) R (right,) C (centre,) J (justify,) or D (decimal)) followed immediately by a number describing the width.
    (HTML 3.0 Only) UNITS=units
    This makes sense only if the COLSPEC or WIDTH attributes are being used and specifies the units to be used for the column or table widths. units should be one of
  • en: widths are in en spaces, proportional to font size
  • relative: column widths are percentage of entire table width, table width is percentage of entire window width
  • pixels: widths are in pixels
  • (HTML 3.0 Only) DP="character"
    Here "character" is the character (the default is ".") to be used in aligning for decimal point alignment.
    (HTML 3.0 Only) NOWRAP
    This attribute prevents word wrap within table entries.

    In the attributes above that refer to it, rrggbb is a six digit hexadecimal number with the first two digits specifying the red value, the middle two the green value, and the last two the blue value. Some sample colour values:

    red
    FF0000
    green
    00FF00
    blue
    0000FF
    black
    000000
    white
    FFFFFF
    grey
    888888
    yellow
    FFFF00
    cyan
    00FFFF

    Microsoft Explorer supports the use of colour names in the BGCOLOR, BORDERCOLOR, BORDERCOLORLIGHT, and BORDERCOLORDARK attributes. Valid colours are: Aqua, Black, Blue, Fuchsia, Gray, Green, Lime, Maroon, Navy, Olive, Purple, Red, Silver, Teal,Yellow, and White.

    CDI Home Page

    Table Body
    Support: HTML:No Support Netscape:No Support MS Explorer:3.0+


    <TBODY> table body </TBODY>

    The TBODY tag is used to group together a number of rows within a table, for assigning ID or STYLE values.

    CLASS=type
    This attribute indicates the class that the element belongs too.
    ID=value
    This attribute specifies a unique value for the element over the docuement.
    STYLE=css1 properties
    This attribute specifies the style information.


    CDI Home Page

    Table Column
    Support: HTML:No Support Netscape:No Support MS Explorer:3.0+


    <COL> content </COL>
    <COL ALIGN=alignment> content </COL>
    <COL SPAN=
    number> content </COL>

    The <COL> tag sets the properties of one table column at a time. Do not use this tag with a COLGROUP element.

    The ALIGN attribute specifies the text alignment in the cells within the colums. The values for "alignment" are LEFT, MIDDLE and RIGHT and the default is MIDDLE.

    CDI Home Page

    Table Column Group
    Support: HTML:No Support Netscape:No Support MS Explorer:3.0+


    <COLGROUP> column data </COLGROUP>
    <COLGROUP ALIGN
    ="align"> column data </COLGROUP>
    <COLGROUP VALIGN=
    "valign"> column data </COLGROUP>
    <COLGROUP HALIGN=
    "halign"> column data </COLGROUP>
    <COLGROUP WIDTH=
    "width"> column data </COLGROUP>
    <COLGROUP SPAN=
    "number"> column data </COLGROUP>

    The COLGROUP tag sets the properties of one or more table columns.

    The HALIGN attribute specifies the horizontal alignment of text in the cells for the column group.. The values are LEFT, RIGHT and CENTER (the default.) The VALIGN attribute sets the vertical alignment for the column. The values are TOP, MIDDLE (the default,) and BOTTOM. The SPAN attribute sets the number of consecutive columns for the group. The WIDTH attribute specifies the width of each column in the column group.

    CDI Home Page

    Table Data
    Support: HTML:3.2 Netscape:1.1+ MS Explorer:2.0+


    <TD attributes>

    Valid only in a TR, the table data tag defines a table cell. The attributes are:

    COLSPAN="number"
    the number of columns this cell occupies.
    ROWSPAN="number"
    the number of rows this cell occupies.
    NOWRAP
    This attribute prevents word wrap within the cell.
    ALIGN="align"
    governs the alignment of the text within the table cell. "align" can be LEFT, RIGHT or CENTER.
    VALIGN="align"
    governs the alignment of the text within the table cell. "align" can be TOP, MIDDLE, BOTTOM, or BASELINE.
    (Microsoft Extension)(Netscape Extension)BGCOLOR="#rrggbb"
    BGCOLOR="colorname"
    This attribute sets the background colour for the table cell.
    (Microsoft Extension)BORDERCOLOR="#rrggbb"
    BORDERCOLOR="colorname"
    This attribute sets the border colour for the table cell.
    (Microsoft Extension)BORDERCOLORLIGHT="#rrggbb"
    BORDERCOLORLIGHT="colorname"
    This attribute sets the border highlight colour for the table cell.
    (Microsoft Extension)BORDERCOLORDARK="#rrggbb"
    BORDERCOLORDARK="colorname"
    This attribute sets the border shadow colour for the table cell.

    In the attributes above that refer to it, rrggbb is a six digit hexadecimal number with the first two digits specifying the red value, the middle two the green value, and the last two the blue value. Some sample colour values:

    red
    FF0000
    green
    00FF00
    blue
    0000FF
    black
    000000
    white
    FFFFFF
    grey
    888888
    yellow
    FFFF00
    cyan
    00FFFF

    Microsoft Explorer supports the use of colour names in the BGCOLOR, BORDERCOLOR, BORDERCOLORLIGHT, and BORDERCOLORDARK attributes. Valid colours are: Aqua, Black, Blue, Fuchsia, Gray, Green, Lime, Maroon, Navy, Olive, Purple, Red, Silver, Teal,Yellow, and White.

    CDI Home Page

    Table Footer
    Support: HTML:No Support Netscape:No Support MS Explorer:3.0+

    <TFOOT>

    Defines the table footer. The footer tag is used to group all footers.

    CLASS=type
    This attribute indicates the class that the element belongs too.
    ID=value
    This attribute specifies a unique value for the element over the document.
    STYLE=css1 properties
    This attribute specifies style the information

    CDI Home Page

    Table Head
    Support: HTML:No Support Netscape:No Support MS Explorer:3.0+


    <THEAD>

    The THEAD tag defines the table heading. The THEAD tag is used to group all headers together.

    ALIGN=left, center, right, justify
    Specifies the alignment of text in the heading, the default is center.
    CLASS=type
    This attribute indicates the class that the element belongs too.
    ID=value
    This attribute specifies a unique value for the element over the document.
    STYLE=css1 properties
    This attribute specifies style the information
    VALIGN=middle/top/bottom
    This attribute specifies the verticle alignment of text in the heading. The default is middle.

    CDI Home Page

    Table Header
    Support: HTML:3.2 Netscape:1.1+ MS Explorer:2.0+


    <TH attributes>

    Valid only in a TR, the table header tag defines a header cell. The attributes are:

    COLSPAN="number"
    the number of columns this header occupies.
    ROWSPAN="number"
    the number of rows this header occupies.
    NOWRAP
    This attribute prevents word wrap within the cell.
    ALIGN="align"
    governs the alignment of the text within the table cell. "align" can be LEFT, RIGHT or CENTER. Table Header cells default to centred.
    VALIGN="align"
    governs the alignment of the text within the table cell. "align" can be TOP, MIDDLE, BOTTOM, or BASELINE.
    (Microsoft Extension)(Netscape Extension)BGCOLOR="#rrggbb"
    BGCOLOR="colorname"
    This attribute sets the background colour for the header cell.
    (Microsoft Extension)BORDERCOLOR="#rrggbb"
    BORDERCOLOR="colorname"
    This attribute sets the border colour for the header cell.
    (Microsoft Extension)BORDERCOLORLIGHT="#rrggbb"
    BORDERCOLORLIGHT="colorname"
    This attribute sets the border highlight colour for the header cell.
    (Microsoft Extension)BORDERCOLORDARK="#rrggbb"
    BORDERCOLORDARK="colorname"
    This attribute sets the border shadow colour for the header cell.

    In the attributes above that refer to it, rrggbb is a six digit hexadecimal number with the first two digits specifying the red value, the middle two the green value, and the last two the blue value. Some sample colour values:

    red
    FF0000
    green
    00FF00
    blue
    0000FF
    black
    000000
    white
    FFFFFF
    grey
    888888
    yellow
    FFFF00
    cyan
    00FFFF

    Microsoft Explorer supports the use of colour names in the BGCOLOR, BORDERCOLOR, BORDERCOLORLIGHT, and BORDERCOLORDARK attributes. Valid colours are: Aqua, Black, Blue, Fuchsia, Gray, Green, Lime, Maroon, Navy, Olive, Purple, Red, Silver, Teal,Yellow, and White.

    CDI Home Page

    Table Row
    Support: HTML:3.2 Netscape:1.1+ MS Explorer:2.0+


    <TR attributes>

    Valid only in a TABLE, the table row tag defines a row of cells that are defined with TH and TD tags. The attributes are:

    ALIGN="align"
    governs the alignment of the text within the table cell. "align" can be LEFT, RIGHT or CENTER.
    VALIGN="align"
    governs the alignment of the text within the table cell. "align" can be TOP, MIDDLE, BOTTOM, or BASELINE.
    (Microsoft Extension)(Netscape Extension)BGCOLOR="#rrggbb"
    BGCOLOR="colorname"
    This attribute sets the background colour for the table row.
    (Microsoft Extension)BORDERCOLOR="#rrggbb"
    BORDERCOLOR="colorname"
    This attribute sets the border colour for the table row.
    (Microsoft Extension)BORDERCOLORLIGHT="#rrggbb"
    BORDERCOLORLIGHT="colorname"
    This attribute sets the border highlight colour for the table row.
    (Microsoft Extension)BORDERCOLORDARK="#rrggbb"
    BORDERCOLORDARK="colorname"
    This attribute sets the border shadow colour for the table row.
    (HTML 3.0 Only) CLASS="class"
    class is one of Header, Body, or Footer and allows the browser to arrange for header or footer rows to be displayed as the user scrolls through the document.

    Valid only in a TABLE, the table row tag defines a row of cells that are defined with TH and TD tags. The class attribute can be set to one of Header, Body, or Footer to arrange for header or footer rows to be displayed as the user scrolls through the document.

    (Microsoft Extension)The ALIGN attribute governs the alignment of the cells within the table rows. "align" can be LEFT or RIGHT. If ALIGN is specified for any cell in the row, the cell alignment overrides the row alignment.