📄 rfc1942.txt
字号:
Raggett Experimental [Page 11]
RFC 1942 HTML Tables May 1996
mm denotes millimeters, em denotes em units (equal to the height of
the default font), and px denotes screen pixels. The default units
are screen pixels (chosen for backwards compatibility). The number is
an integer value or a real valued number such as "2.5". Exponents, as
in "1.2e2", are not allowed. White space is not allowed between the
number and the suffix.
The above set of suffices is augmented for certain elements: "%" is
used for the WIDTH attribute for the TABLE element. It indicates that
the attribute specifies the percentage width of the space between the
current left and right margins, e.g. width="50%". For the COL
element, "*" is used with the WIDTH attribute to specify relative
column widths, e.g. width="3*", using the same representation as the
CALS table model.
The TABLE element
<!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.
ID, CLASS, LANG and DIR
See earlier description of common attributes.
ALIGN
Defines the horizontal position of the table relative to the
current left and right margins. ALIGN=CENTER centers the table
Raggett Experimental [Page 12]
RFC 1942 HTML Tables May 1996
midway between the left and right margins. ALIGN=LEFT positions
the table at the left margin, while ALIGN=RIGHT positions the
table at the right margin. User agents may flow text around the
right handside of the table for ALIGN=LEFT, or the left handside
for ALIGN=RIGHT.
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.
WIDTH
Specifies the desired width of the table. In addition to the
standard units, the "%" sign may used to indicate that the width
specifies the percentage width of the space between the current
left and right margins, e.g. width="50%". In the absence of this
attribute, the table width can be determined by the layout
algorithm given later on.
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.
COLS
Specifies the number of columns for the table. If present the
user agent may render the table dynamically as data is received
from the network without waiting for the complete table to be
received. If the WIDTH attribute is missing, a default of "100%"
may be assumed for this purpose. If the COLS attribute is
absent, a prepass through the table's contents is needed to
determine the number of columns together with suitable values
for the widths of each column.
BORDER
Specifies the width of the border framing the table, see
standard units.
FRAME
Specifies which sides of the frame to render.
<!ENTITY % Frame
"(void|above|below|hsides|lhs|rhs|vsides|box|border)">
Raggett Experimental [Page 13]
RFC 1942 HTML Tables May 1996
VOID
Don't render any sides of the frame.
ABOVE
The top side of the frame
BELOW
The bottom side of the frame
HSIDES
The top and bottom sides of the frame
LHS
The left hand side of the frame
RHS
The right hand side of the frame
VSIDES
The left and right sides of the frame
BOX
All four sides of the frame
BORDER
All four sides of the frame
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
Raggett Experimental [Page 14]
RFC 1942 HTML Tables May 1996
enumerated values outweighs the need for consistent names.
RULES
Specifies where to draw rules within the table interior.
<!ENTITY % Rules "(none | groups | rows | cols | all)">
NONE
Suppresses internal rulings.
GROUPS
The THEAD, TFOOT and TBODY elements divide the table into
groups of rows, while COLGROUP elements divide the table
into groups of columns. This choice places a horizontal rule
between each row group and a vertical rule between each
column group. Note that every table has at least one row and
one column group.
ROWS
As RULES=GROUPS plus horizontal rules between all rows. User
agents may choose to use a heavier rule between groups of
rows and columns for emphasis.
COLS
As RULES=GROUPS plus vertical rules between all columns.
User agents may choose to use a heavier rule between groups
of rows and columns for emphasis.
ALL
Place rules between all rows and all columns. User agents
may choose to use a heavier rule between groups of rows and
columns for emphasis.
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.
CELLSPACING
This attribute is intended for backwards compatibility with
deployed user agents. It specifies the space between the table
frame and the first or last cell border for each row or column,
and between other cells in the table. See standard units.
Greater control will be possible using style sheet languages.
CELLPADDING
This attribute is intended for backwards compatibility with
deployed user agents. It specifies the amount of space between
the border of the cell and its contents both above/below, and
Raggett Experimental [Page 15]
RFC 1942 HTML Tables May 1996
left//right. See standard units. Greater control will be
possible using style sheet languages.
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.
Table Captions
<!ELEMENT caption - - (%text;)+>
<!ENTITY % Caption "(top|bottom|left|right)">
<!ATTLIST caption -- table caption --
%attrs; -- id, lang, dir and class --
align %Caption; #IMPLIED -- relative to table --
>
The optional CAPTION element is used to provide a caption for the
table. Both start and end tags are required.
ID, CLASS, LANG and DIR
See earlier description of common attributes.
ALIGN
This may be used to control the placement of captions relative
to the table. When present, the ALIGN attribute should have one
of the values: TOP, BOTTOM, LEFT and RIGHT. It is recommended
that the caption is made to fit within the width or height of
the table as appropriate. The default position of the caption is
deliberately unspecified.
Note the ALIGN attribute is overused in HTML, but is retained
here for compatibility with currently deployed browsers.
The COLGROUP Element
<!ELEMENT colgroup - O (col*)>
<!ATTLIST colgroup
%attrs; -- id, lang, dir and class --
span NUMBER 1 -- default number of columns in --
-- group --
width CDATA #IMPLIED -- default width for enclosed --
-- COLs --
%cell.halign; -- horizontal alignment in --
-- cells --
Raggett Experimental [Page 16]
RFC 1942 HTML Tables May 1996
%cell.valign; -- vertical alignment in cells --
>
The COLGROUP element acts as a container for a group of columns, and
allows you to set default properties for these columns. In the
absence of a COLGROUP element, all columns in the table are assumed
to belong to a single column group. Each COLGROUP element can
contain zero or more COL elements. COLGROUP requires a start tag,
but the end tag may be omitted. This is useful when defining a
sequence of COLGROUP elements, e.g.
<TABLE FRAME=BOX RULES=COLS>
<COLGROUP>
<COL WIDTH="1*">
<COL WIDTH="2*">
<COLGROUP>
<COL WIDTH="1*">
<COL WIDTH="3*">
<THEAD>
<TR> ...
</TABLE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -