[previous page] [table of contents] [to next page]

Tags and Attributes for Tables

  • <table> tag attributes:
    • align={x}
         {x = LEFT, RIGHT, CENTER}
         Note: this attribute is depricated in HTML 4.0 and later.
    • background="{img.src}"
         Sets the background of a table to an image
         where {img.src} is the URL and name of a linked image file
    • bgcolor="{x}"
         Sets the background color for the table (or it's cells), where {x} is a color name
         or a hexadecimal color representaion (eg."#ff00ff").
    • border="{x}"
         {x} = width in pixels
    • bordercolor="{x}"
         {x} = a color name
         or a hexadecimal color representaion (eg."#ff00ff")
    • cellpadding={x}
         sets space between every cell element and cell walls to {x} pixels
    • cellspacing={x}
         sets width of cell walls to {x} pixels
    • summary={x}
         (HTML 4.x)
         This attribute provides a summary of the table's purpose and structure for
         user agents (browsers) rendering to non-visual media such as speech and Braille.
    • width="{x}[%]"
         x = width in pixels; x% = width as a percentage of available space

      Example:
      <TABLE border="1" align="left" bgcolor="white" border="0" width="80%"
      summary="This table charts the number of cups of coffee consumed by each senator, the type of coffee (decaf or regular), and whether taken with sugar.">


  • <caption> tag :
    used inside the opening and closing <table> tag:
    • align={x}
         {x = TOP, BOTTOM, RIGHT, LEFT}
  • <tr> tag : (table row)
    used inside the opening and closing <table> tag:
    Creates a table row.
    • bgcolor="{x}"
      sets background color for row
  • <td> tag : (table data)
    used inside an opening and closing <tr> tag:
    Creates a data cell within a table row.
    • bgcolor="{x}"
      sets background color for cell
    • width="{x}(%)"
      sets width for cell; {x} can be expressed as a fixed pixel number or a percentage of the table width
To see a page with a variey of table layouts and attributes, visit my Table Settings Using Ogham Letters page!


[click to go to previous page] [to index page] [to top of this page] [to next page]

Copyrightę 1998. Liberty Miller . All rights reserved.
This material may not be reproduced without the written permission of the author.
Last Modified 01/05/99

Appendix A: Tags