TABLES Elements
Using the Table Element HTML allows one to define logical Tables
on the screen. The Table contains other elements to define the
structure of the Table.
TABLE Element
The TABLE element declares that the
embedded information should be presented in the form of a logical
table. The table is composed of Table Rows and an optional Caption.
It can be in:
- BLOCKQUOTE
- BODY
- CENTER
- DD
- DIV
- LI
- TD
- TH
It can contain:
Table Attributes
- ALIGN
- BORDER
- CELLPADDING
- CELLSPACING
- HSPACE
- VSPACE
- WIDTH
Syntax:
<TABLE> ... </TABLE>
General form (HTML 3.2):
<TABLE ATTRIBUTES>
<CAPTION> ... </CAPTION>
<TR> ... </TR>
...
</TABLE>
CAPTION Element
The CAPTION element contains an
caption for the Table. The Caption is normally displayed at
the top of the table. If the ALIGN="bottom" attribute is given,
it isdisplayed at the bottom of the table.
It can be in:
It can contain:
Syntax:
<CAPTION> ... </CAPTION>
or
<CAPTION ALIGN="bottom"> ... </CAPTION>
or
<CAPTION ALIGN="top"> ... </CAPTION>
TR Element
The <TR> defines a row of the
table. It can only contain the TD and TH elements. The TD and
TH elements define the number of columns in the row.
It can be in:
It can contain:
TR Attributes
HALIGN
VALIGN
Syntax:
<TR> ... </TR>
TD Element
The <TD> defines a cell in a row of
the table. It is always contain within a TR (Table Row) element.
It can be in:
It can contain:
- A
- BR
- IMG
- P
- PRE
- H1...H6
- TABLE
- DIR
- MENU
- OL
- UL
TD Attributes
- COLSPAN
- HALIGN
- VALIGN
- WIDTH
- HEIGHT
- NOWRAP
Syntax:
<TD> ... </TD>
TH Element
The <TH> defines a cell in a row of
the table. It is always contain within a TR (Table Row) element.
The only difference between TD and TH is that TH presents the data
in a Header format.
It can be in:
It can contain:
- A
- BR
- IMG
- P
- PRE
- H1...H6
- TABLE
- DIR
- MENU
- OL
- UL
TH Attributes
- COLSPAN
- HALIGN
- VALIGN
- WIDTH
- HEIGHT
- NOWRAP
Syntax:
<TH> ... </TH>