|
|
HTML <table> tag
Syntax
<table> - </table>
Definition and Usage
The TABLE element defines a table for
multi-dimensional data arranged in rows and columns.
Optional Attributes
| Attribute |
Value |
Description |
| align |
left
center
right |
Aligns the table. Deprecated.
Use style sheets. |
| bgcolor |
rgb(x,x,x)
#xxxxxx
colorname |
Specifies the background color of the table. Deprecated.
Use style sheets. |
| border |
pixels |
Specifies the border width. Value 0 means no border
|
| cellpadding |
pixels
% |
Specifies the space between the cell walls and contents |
| cellspacing |
pixels
% |
Specifies the space between cells |
| frame |
void
above
below
hsides
lhs
rhs
vsides
box
border |
Specifies how the outer borders should be displayed.
Note: Must be used in conjunction with the "border"
attribute
|
| rules |
none
groups
rows
cols
all |
Specifies the horizontal/vertical divider lines.
Note: Must be used in conjunction with the "border"
attribute
|
| summary |
text |
Specifies a summary of the table for
speech-synthesizing/non-visual browsers |
| width |
%
pixels |
Specifies the width of the table |
Standard Attributes
| id, class, title, style, dir, lang, xml:lang |
For a full description, go to Standard
Attributes.
Event Attributes
| onclick, ondblclick, onmousedown, onmouseup, onmouseover,
onmousemove, onmouseout, onkeypress, onkeydown, onkeyup |
For a full description, go to Event Attributes.
Example
| Source |
Output |
<table border = "4">
<tr>
<td>Cell 1</td>
<td>Cell 3</td>
</tr>
<tr>
<td>Cell 2</td>
<td>Cell 4</td>
</tr>
</table> |
| Cell 1 |
Cell 3 |
| Cell 2 |
Cell 4 |
|
|
|