<TABLE> Tag & its Attribute
HTML Tag <TABLE>
<TABLE> Specifies a container for a table within your document. Inside these tags you can place <TR>, <TD>, <TH>, <CAPTION>, and other <TABLE> tags.
Attribute of <TABLE> Tag
- ALIGN
- BACKGROUND
- BGCOLOR
- BORDER
- BORDERCOLOR
- BORDERCOLORDARK
- BORDERCOLORLIGHT
- CELLPADDING
- CELLSPACING
- CLASS
- COLS
- FRAME
- ID
- RULES
- TITLE
- WIDTH
ALIGN
Positions the table flush left, flush right, or in the center of the window.
<TABLE ALIGN=CENTER>
Possible Values
LEFT, CENTER, RIGHT
BACKGROUND
Specifies the relative or absolute location of a graphic image file loaded as a background image for the entire table.
<TABLE BACKGROUND="paper.jpg">
Possible Values
URL
BGCOLOR
Specifies the background color within all table cells in the table. You can substitute color names for the hexadecimal RGB values.
<TABLE BGCOLOR="Peach">
Possible Values
Color Name or Hexadecimal color code.
BORDER
Specifies the thickness (in pixels) of borders around each table cell. Use a value of 0 to produce a table with no visible borders.
<TABLE BORDER=0>
Possible Values
Value in Pixel.
BORDERCOLOR
Specifies the color of the borders of all the table cells in the table. You can substitute color names for the hexadecimal RGB values.
<TABLE BORDERCOLOR=#3F9A11>
Possible Values
Color name or hexadecimal color code.
BORDERCOLORDARK
Specifies the darker color used to draw 3-D borders around the table cells. You can substitute color names for the hexadecimal RGB values.
<TABLE BORDERCOLORDARK="silver">
Possible Values
Color name or hexadecimal color code.
BORDERCOLORLIGHT
Specifies the lighter color used to draw 3-D borders around the table cells. You can substitute color names for the hexadecimal RGB values.
<TABLE BORDERCOLORDARK="white">
Possible Values
Color name or hexadecimal color code.
CELLPADDING
Specifies the space (in pixels) between the edges of table cells and their contents.
<TABLE CELLPADDING=5>
Possible Values
Value in Pixel.
CELLSPACING
Specifies the space (in pixels) between the borders of table cells and the borders of adjacent cells.
<TABLE BORDER=2 CELLSPACING=5>
Possible Values
Value in Pixel.
CLASS
Indicates which style class applies to the <TABLE> element.
<TABLE CLASS="dkm" BORDER=2>
Possible Values
Any Class Name.
COLS
Specifies the number of columns in the table.
<TABLE BORDER=2 COLS=5>
Possible Values
Number of Columns.
FRAME
Specifies the external border lines around the table. For the FRAME= attribute to work, set the BORDER= attribute with a non-zero value. FRAME=VOID indicates no border lines. FRAME=BOX or FRAME=BORDER indicates border lines around the entire table. This is the default. FRAME=ABOVE specifies a border line along the top edge. FRAME=BELOW draws a border line along the bottom edge. FRAME=HSIDES draws border lines along the top and bottom edges. FRAME=LHS indicates a border line along the left side. FRAME=RHS draws a border line along the right edge. FRAME=VSIDES draws border lines along the left and right edges.
<TABLE BORDER=2 RULES=ALL FRAME=VSIDES>
Possible Values
Frame Name.
ID
Assigns a unique ID selector to an instance of the <TABLE> tag. When you then assign a style to that ID selector, it affects only that one instance of the <TABLE> tag.
<TABLE ID="dkm">
Possible Values
Any ID Name.
RULES
Specifies where rule lines appear inside the table. For the RULES= attribute to work, set the BORDER= attribute. RULES=NONE indicates no rule lines. RULES=ROWS indicates rule lines between rows. RULES=COLS draws rule lines between columns. RULES=ALL draws all possible rule lines. RULES=GROUPS specifies rule lines between the groups defined by the <TFOOT>, <THEAD>, <TBODY>, and <COLGROUP> tags.
<TABLE BORDER=2 RULES=BASIC>
Possible Values
NONE, ROWS, COLS, GROUPS, ALL
TITLE
Specifies text assigned to the tag. You might use this attribute for context-sensitive help within the document. Browsers may use this to show tool tips over the table.
<TABLE TITLE="dkm">
Possible Values
Any text message.
WIDTH
Specifies the width of the table. You can set this value to an absolute number of pixels or to a percentage amount so that the table is proportionally as wide as the available space.
<TABLE ALIGN=CENTER WIDTH="60%">
Possible Values
Value in Pixel.