<!ENTITY % Where "(left|center|right)">
<!ELEMENT table - - (caption?, (col*|colgroup*), thead?, tfoot?, tbody+)>
<!ATTLIST table -- table element --
%attrs; -- id, lang, dir and class --
align %Where; #IMPLIED -- table position relative to --
-- window --
width CDATA #IMPLIED -- table width relative to window --
cols NUMBER #IMPLIED -- used for immediate display mode --
border CDATA #IMPLIED -- controls frame width around --
-- table --
frame %Frame; #IMPLIED -- which parts of table frame to --
-- include --
rules %Rules; #IMPLIED -- controls rules between cells --
cellspacing CDATA #IMPLIED -- spacing between cells --
cellpadding CDATA #IMPLIED -- spacing within cells --
>
The TABLE element requires both start and end tags. Table elements start with an optional CAPTION element, optionally followed by either one or more COL elements, or one or more COLGROUP elements, then an optional THEAD, an optional TFOOT, and finally one or more TBODY elements.
Note you can use <BR CLEAR=LEFT> after the table element if you want to avoid text flowing along side the table when you have specified ALIGN=LEFT, or <BR CLEAR=RIGHT> for a right aligned table. To prevent a right aligned table flowing around something else, use <BR CLEAR=RIGHT> before the table etc. Greater control over textflow is possible using style sheets.
It is recommended that the table width be increased beyond the value indicated by the WIDTH attribute as needed to avoid any overflow of cell contents. Such increases should try to avoid drastic changes to relative column widths specified by the author. To avoid the need for excessive horizontal scrolling, or when such scrolling is impractical or undesired, it may be appropriate to split words across lines.
<!ENTITY % Frame
"(void|above|below|hsides|lhs|rhs|vsides|box|border)">
The value "Border" is included for backwards compatibility with deployed browsers. If a document includes <TABLE BORDER> the user agent will see FRAME=BORDER and BORDER=_implied_. If the document includes <TABLE BORDER=_n_> then the user agent should treat this as FRAME=BORDER except if _n=0_ for which FRAME=VOID is appropriate.
Note: it would have been preferable to choose values for FRAME consistent with the RULES attribute and the values used for alignment. For instance: none, top, bottom, topbot, left, right, leftright, all. Unfortunately, SGML requires enumerated attribute values to be unique for each element, independent of the attribute name. This causes immediate problems for "none", "left", "right" and "all". The values for FRAME have been chosen to avoid clashes with the RULES, ALIGN and VALIGN attributes. This provides a measure of future proofing, as it is anticipated that that the FRAME and RULES attributes will be added to other table elements in future revisions to this specification. An alternative would be to make FRAME a CDATA attribute. The consensus of the HTML-WG was that the benefits of being able to use SGML validation tools to check attributes based on enumerated values outweighs the need for consistent names.
<!ENTITY % Rules "(none | groups | rows | cols | all)">
If a document includes <TABLE BORDER> or <TABLE BORDER=_n_> then the default for the table element is RULES=ALL, except if _n=0_ for which RULES=NONE is appropriate.
If a fixed width is set for the table or column, the CELLSPACING and CELLPADDING may demand more space than assigned. Current practice is for the latter to take precedence over WIDTH attributes when a conflict occurs, although this isn't required by this specification.