then
770 the default for the table element is RULES=ALL, except if _n=0_
771 for which RULES=NONE is appropriate.
773 CELLSPACING
774 This attribute is intended for backwards compatibility with
775 deployed user agents. It specifies the space between the table
776 frame and the first or last cell border for each row or column,
777 and between other cells in the table. See standard units.
778 Greater control will be possible using style sheet languages.
780 CELLPADDING
781 This attribute is intended for backwards compatibility with
782 deployed user agents. It specifies the amount of space between
783 the border of the cell and its contents both above/below, and
784 left//right. See standard units. Greater control will be
785 possible using style sheet languages.
787 If a fixed width is set for the table or column, the CELLSPACING and
788 CELLPADDING may demand more space than assigned. Current practice is
789 for the latter to take precedence over WIDTH attributes when a
790 conflict occurs, although this isn't required by this specification.
792 ------------------------------------------------------------------------------
793 Table Captions
795
797
799
804 The optional CAPTION element is used to provide a caption for the
805 table. Both start and end tags are required.
807 ID, CLASS, STYLE, LANG and DIR
808 See earlier description of common attributes.
810 HTML Tables 23 Jan 96
812 ALIGN
813 This may be used to control the placement of captions relative
814 to the table. When present, the ALIGN attribute should have one
815 of the values: TOP, BOTTOM, LEFT and RIGHT. It is recommended
816 that the caption is made to fit within the width or height of
817 the table as appropriate. The default position of the caption is
818 deliberately unspecified.
820 _Note the ALIGN attribute is overused in HTML, but is retained
821 here for compatibility with currently deployed browsers._
823 ------------------------------------------------------------------------------
824 The COLGROUP Element
826
828
836 The COLGROUP element acts as a container for a group of columns, and
837 allows you to set default properties for these columns. In the
838 absence of a COLGROUP element, all columns in the table are assumed
839 to belong to a single column group. Each COLGROUP element can
840 contain zero or more COL elements. COLGROUP requires a start tag,
841 but the end tag may be omitted. This is useful when defining a
842 sequence of COLGROUP elements, e.g.
844
845
846
847
848
849
850
851
852 ...
853
855 COLGROUP elements can be used with the following attributes:
857 ID, CLASS, STYLE, LANG and DIR
858 See earlier description of common attributes.
860 HTML Tables 23 Jan 96
862 SPAN
863 A positive integer value that specifies a default for how many
864 columns are in this group. This attribute should be ignored if
865 the COLGROUP element contains one or more COL elements. It
866 provides a convenient way of grouping columns without the need
867 to supply COL elements.
869 WIDTH
870 Specifies a default width for each of the grouped columns, see
871 standard units. In addition, the "*" suffix denotes relative
872 widths, e.g.
874 width=64 width in screen pixels
875 width=0.5* a relative width of 0.5
877 Relative widths act as constraints on the relative widths of
878 different columns. If a COLGROUP element specifies a relative
879 width of zero, all of the columns in the group should be set to
880 their minimum widths, unless they are associated with a COL
881 element with an overriding WIDTH attribute. When widths are
882 given in absolute units, the user agent can use these to
883 constrain the width of the table. The "*" suffix is used to
884 simplify importing tables from the CALS representation.
886 ALIGN, CHAR, CHAROFF and VALIGN
887 Specify values for horizontal and vertical alignment within
888 table cells. See inheritance order of alignment properties.
890 ------------------------------------------------------------------------------
891 The COL Element
893
895
903 This optional element is used to specify column based defaults for
904 table properties. It is an empty element, and as such has no
905 content, and shouldn't be given an end tag. Several COL elements may
906 be given in succession. COL attributes override those of the parent
907 COLGROUP element.
909 ID, CLASS, STYLE, LANG and DIR
910 See earlier description of common attributes.
912 SPAN
913 A positive integer value that specifies how many columns this
914 element applies to, defaulting to one. In the absence of SPAN
916 HTML Tables 23 Jan 96
918 attributes the first COL element applies to the first column,
919 the second COL element to the second column and so on. If the
920 second COL element had SPAN=2, it would apply to the second and
921 third column. The next COL element would then apply to the
922 fourth column and so on. SPAN=0 has a special significance and
923 implies that the COL element spans all columns from the current
924 column up to and including the last column. Note that a COL SPAN
925 does not define a group. It is merely a way to share attribute
926 definitions.
928 WIDTH
929 Specifies the width of the columns, see standard units. If the
930 element spans several columns then the WIDTH attribute specifies
931 the width for each of the individual columns - not the width of
932 the span. In addition, the "*" suffix denotes relative widths,
933 e.g.
935 width=64 width in screen pixels
936 width=0.5* a relative width of 0.5
938 Relative widths act as constraints on the relative widths of
939 different columns. If a COL element specifies a relative width
940 of zero, the column should always be set to its minimum width.
941 When widths are given in absolute units, the user agent can use
942 these to constrain the width of the table. The "*" suffix is
943 used to simplify importing tables from the CALS representation.
945 ALIGN, CHAR, CHAROFF and VALIGN
946 Specify values for horizontal and vertical alignment within
947 table cells. See inheritance order of alignment properties.
949 ------------------------------------------------------------------------------
950 Table Head, Foot and Body Elements
952
953
954
956
962 Tables may be divided up into head and body sections. The THEAD and
963 TFOOT elements are optional, but one or more TBODY elements are
964 always required. If the table only consists of a TBODY section, the
965 TBODY start and end tags may be omitted, as the parser can infer
966 them. If a THEAD element is present, the THEAD start tag is
967 required, but the end tag can be omitted, provided a TFOOT or TBODY
968 start tag follows. The same applies to TFOOT.
970 HTML Tables 23 Jan 96
972 _Note: This definition provides compatibility with tables created
973 for the older model, as well as allowing the end tags for THEAD,
974 TFOOT and TBODY to be omitted._
976 The THEAD, TFOOT and TBODY elements provide a convenient means for
977 controlling rendering. If the table has a large number of rows in
978 the body, user agents may choose to use a scrolling region for the
979 table body sections. When rendering to a paged device, tables will
980 often have to be broken across page boundaries. The THEAD, TFOOT and
981 TBODY elements allow the user agent to repeat the table foot at the
982 bottom of the current page, and then the table head at the top of
983 the new page before continuing on with the table body.
985 TFOOT is placed before the TBODY in the markup sequence, so that
986 browsers can render the foot before receiving all of the table data.
987 This is useful when very long tables are rendered with scrolling
988 body sections, or for paged output, involving breaking the table
989 over many pages.
991 Each THEAD, TFOOT and TBODY element must contain one or more TR
992 elements.
994 ID, CLASS, STYLE, LANG and DIR
995 See earlier description of common attributes.
997 ALIGN, CHAR, CHAROFF and VALIGN
998 Specify values for horizontal and vertical alignment within
999 table cells. See inheritance order of alignment properties.
1001 ------------------------------------------------------------------------------
1002 Table Row (TR) elements
1004
1006
1012 The TR or table row element acts as a container for a row of table
1013 cells. The end tag may be omitted.
1015 ID, CLASS, STYLE, LANG and DIR
1016 See earlier description of common attributes.
1018 ALIGN, CHAR, CHAROFF and VALIGN
1019 Specify values for horizontal and vertical alignment within
1020 table cells. See inheritance order of alignment properties.
1022 ------------------------------------------------------------------------------
1023 HTML Tables 23 Jan 96
1025 Table Cells: TH and TD
1027
1029
1040 TH elements are used to represent header cells, while TD elements
1041 are used to represent data cells. This allows user agents to render
1042 header and data cells distinctly, even in the absence of style
1043 sheets.
1045 Cells can span multiple rows and columns, and may be empty. Cells
1046 spanning rows contribute to the column count on each of the spanned
1047 rows, but only appear in the markup once (in the first row spanned).
1048 The row count is determined by the number of TR elements. Any rows
1049 implied by cells spanning rows beyond this should be ignored.
1051 If the column count for the table is greater than the number of
1052 cells for a given row (after including cells for spanned rows), the
1053 missing cells are treated as occurring on the right hand side of the
1054 table and rendered as empty cells. If the language context indicates
1055 a right to left writing order, then the missing cells should be
1056 placed on the left hand side.
1058 It is possible to create tables with overlapping cells, for
1059 instance:
1061
1062 1 | 2 | 3
1063 |
4
1064 |
5 | 6
1065 |
1067 which might look something like:
1069 /-----------\
1070 | 1 | 2 | 3 |
1071 | |-------|
1072 | | 4 | |
1073 |---|...|---|
1074 | 5 : | 6 |
1075 \-----------/
1077 HTML Tables 23 Jan 96
1079 In this example, the cells labelled 4 and 5 overlap. In such cases,
1080 the rendering is implementation dependent.
1082 The AXIS and AXES attributes for cells provide a means for defining
1083 concise labels for cells. When rendering to speech, these attributes
1084 may be used to provide abbreviated names for the headers relevant to
1085 each cell. Another application is when you want to be able to later
1086 process table contents to enter them into a database. These
1087 attributes are then used to give database field names. The table's
1088 class attribute should be used to let the software recognize which
1089 tables can be treated in this way.
1091 ID, CLASS, STYLE, LANG and DIR
1092 See earlier description of common attributes.
1094 AXIS
1095 This defines an abbreviated name for a header cell, e.g. which
1096 can be used when rendering to speech. It defaults to the cell's
1097 content.
1099 AXES
1100 This is a comma separated list of axis names which together
1101 identify the row and column headers that pertain to this cell.
1102 It is used for example when rendering to speech to identify the
1103 cell's position in the table. If missing the user agent can try
1104 to follow up columns and left along rows (right for some
1105 languages) to find the corresponding header cells.
1107 NOWRAP, e.g.
1108 The presence of this attribute disables automatic wrapping of
1109 text lines for this cell. If used uncautiously, it may result in
1110 excessively wide cells. This attribute is defined for backwards
1111 compatibility with deployed user agents. Greater control is
1112 possible with associated style sheet languages (for example for
1113 control over overflow handling).
1115 ROWSPAN, e.g. |
1116 A positive integer value that defines how may rows this cell
1117 spans. The default ROWSPAN is 1. ROWSPAN=0 has a special
1118 significance and implies that the cell spans all rows from the
1119 current row up to the last row of the table.
1121 COLSPAN, e.g. |
1122 A positive integer value that defines how may columns this cell
1123 spans. The default COLSPAN is 1. COLSPAN=0 has a special
1124 significance and implies that the cell spans all columns from
1125 the current column up to the last column of the table.
1127 ALIGN, CHAR, CHAROFF and VALIGN
1128 Specify values for horizontal and vertical alignment within
1129 table cells. See inheritance order of alignment properties.
1131 HTML Tables 23 Jan 96
1133 Note: It is recommended that implementors provide support for the
1134 Netscape 1.1 WIDTH attribute for TH and TD, although this isn't part
1135 of the current specification. Document authors are advised to use
1136 the width attribute for the COL element instead.
1138 ------------------------------------------------------------------------------
1139 Recommended Layout Algorithms
1141 If the COLS attribute on the TABLE element specifies the number of
1142 columns, then the table may be rendered using a fixed layout,
1143 otherwise the autolayout algorithm described below should be used.
1145 Fixed Layout Algorithm
1147 For this algorithm, it is assumed that the number of columns is
1148 known. The column widths by default should be set to the same size.
1149 Authors may override this by specifying relative or absolute column
1150 widths, using the COLGROUP or COL elements. The default table width
1151 is the space between the current left and right margins, but may be
1152 overridden by the WIDTH attribute on the TABLE element, or
1153 determined from absolute column widths. To deal with mixtures of
1154 absolute and relative column widths, the first step is to allocate
1155 space from the table width to columns with absolute widths. After
1156 this, the space remaining is divided up between the columns with
1157 relative widths.
1159 The table syntax alone is insufficient to guarantee the consistency
1160 of attribute values. For instance, the number of columns specified
1161 by the COLS attribute may be inconsistent with the number of columns
1162 implied by the COL elements. This in turn, may be inconsistent with
1163 the number of columns implied by the table cells. A further problem
1164 occurs when the columns are too narrow to avoid overflow of cell
1165 contents. The width of the table as specified by the TABLE element
1166 or COL elements may result in overflow of cell contents. It is
1167 recommended that user agents attempt to recover gracefully from
1168 these situations, e.g. by hyphenating words and resorting to
1169 splitting words if hyphenation points are unknown.
1171 In the event that an indivisible element causes cell overflow, the
1172 user agent may consider adjusting column widths and re-rendering the
1173 table. In the worst case clipping may be considered if column width
1174 adjustments and/or scrollable cell content are not feasible. In any
1175 case if cell content is split or clipped this should be indicated to
1176 the user in an appropriate manner.
1178 Autolayout Algorithm
1180 If the COLS attribute is missing from the table start tag, then the
1181 user agent should use the following autolayout algorithm. It uses
1182 two passes through the table data and scales linearly with the size
1183 of the table.
1185 HTML Tables 23 Jan 96
1187 In the first pass, line wrapping is disabled, and the user agent
1188 keeps track of the minimum and maximum width of each cell. The
1189 maximum width is given by the widest line. As line wrap has been
1190 disabled, paragraphs are treated as long lines unless broken by
1191 elements. The minimum width is given by the widest word or image
1192 etc. taking into account leading indents and list bullets etc. In
1193 other words, if you were to format the cell's content in a window of
1194 its own, determine the minimum width you could make the window
1195 before the cell begins to overflow. Allowing user agents to split
1196 words will minimize the need for horizontal scrolling or in the
1197 worst case clipping of cell contents.
1199 This process also applies to any nested tables occuring in cell
1200 content. The minimum and maximum widths for cells in nested tables
1201 are used to determine the minimum and maximum widths for these
1202 tables and hence for the parent table cell itself. The algorithm is
1203 linear with aggregate cell content, and broadly speaking independent
1204 of the depth of nesting.
1206 To cope with character alignment of cell contents, the algorithm
1207 keeps three running min/max totals for each column: Left of align
1208 char, right of align char and un-aligned. The minimum width for a
1209 column is then: max(min_left + min_right, min_non-aligned).
1211 The minimum and maximum cell widths are then used to determine the
1212 corresponding minimum and maximum widths for the columns. These in
1213 turn, are used to find the minimum and maximum width for the table.
1214 Note that cells can contain nested tables, but this doesn't
1215 complicate the code significantly. The next step is to assign column
1216 widths according to the available space (i.e. the space between the
1217 current left and right margins).
1219 For cells which span multiple columns, a simple approach, as used by
1220 Arena, is to evenly apportion the min/max widths to each of the
1221 constituent columns. A slightly more complex approach is to use the
1222 min/max widths of unspanned cells to weight how spanned widths are
1223 apportioned. Experimental study suggests a blend of the two
1224 approaches will give good results for a wide range of tables.
1226 The table borders and intercell margins need to be included in
1227 assigning column widths. There are three cases:
1229 1. The minimum table width is equal to or wider than the available
1230 space. In this case, assign the minimum widths and allow the
1231 user to scroll horizontally. For conversion to braille, it will
1232 be necessary to replace the cells by references to notes
1233 containing their full content. By convention these appear before
1234 the table.
1236 2. The maximum table width fits within the available space. In this
1237 case, set the columns to their maximum widths.
1239 HTML Tables 23 Jan 96
1241 3. The maximum width of the table is greater than the available
1242 space, but the minimum table width is smaller. In this case,
1243 find the difference between the available space and the minimum
1244 table width, lets call it W. Lets also call D the difference
1245 between maximum and minimum width of the table.
1247 For each column, let d be the difference between maximum and
1248 minimum width of that column. Now set the column's width to the
1249 minimum width plus d times W over D. This makes columns with
1250 large differences between minimum and maximum widths wider than
1251 columns with smaller differences.
1253 This assignment step is then repeated for nested tables using the
1254 minimum and maximum widths derived for all such tables in the first
1255 pass. In this case, the width of the parent (i.e. enclosing) table
1256 cell plays the role of the current window size in the above
1257 description. This process is repeated recursively for all nested
1258 tables. The topmost table is then rendered using the assigned
1259 widths. Nested tables are subsequently rendered as part of the
1260 parent table's cell contents.
1262 If the table width is specified with the WIDTH attribute, the user
1263 agent attempts to set column widths to match. The WIDTH attribute is
1264 not binding if this results in columns having less than their
1265 minimum (i.e. indivisible) widths.
1267 If relative widths are specified with the COL element, the algorithm
1268 is modified to increase column widths over the minimum width to meet
1269 the relative width constraints. The COL elements should be taken as
1270 hints only, so columns shouldn't be set to less than their minimum
1271 width. Similarly, columns shouldn't be made so wide that the table
1272 stretches well beyond the extent of the window. If a COL element
1273 specifies a relative width of zero, the column should always be set
1274 to its minimum width.
1276 ------------------------------------------------------------------------------
1277 HTML Tables 23 Jan 96
1279 HTML Table DTD
1281 The DTD or document type definition provides the formal definition
1282 of the allowed syntax for HTML tables.
1284
1293
1300
1315
1317
1324
1326
1327
1329 HTML Tables 23 Jan 96
1331
1332
1338
1339
1343
1344
1345
1346
1347
1348
1349
1350
1351
1353
1365
1366
1368
1373
1377
1385 HTML Tables 23 Jan 96
1387
1396
1404
1416
1422
1428
1439 HTML Tables 23 Jan 96
1441 ------------------------------------------------------------------------------
1442 References
1444 Arena
1445 W3C's HTML3 browser, see "http://www.w3.org/pub/WWW/Arena/".
1446 Arena was originally created as a proof of concept demo for
1447 ideas in the HTML+ specification that preceded HTML3. The
1448 browser is now being re-implemented to provide a reference
1449 implementation of HTML3 along with support for style sheets and
1450 client-side scripting.
1452 CALS
1453 Continuous Acquisition and Life-Cycle Support (formerly
1454 Computer-aided Acquisition and Logistics Support) (CALS) is a
1455 Department of Defense (DoD) strategy for achieving effective
1456 creation, exchange, and use of digital data for weapon systems
1457 and equipment. More information can be found from the US Navy
1458 CALS home page at http://navysgml.dt.navy.mil/cals.html
1460 HTML 3.0
1461 HyperText Markup Language Specification Version 3.0. This is the
1462 initial draft specification as published in March 1995. Work on
1463 refining HTML3 is proceeding piecemeal with the new table
1464 specification as one of the pieces. For W3C related work on
1465 HTML, see "http://www.w3.org/pub/WWW/MarkUp/".
1467 RFC 1766
1468 "Tags for the Identification of Languages", by H. Alvestrand,
1469 UNINETT, March 1995. This document can be downloaded from
1470 "ftp://ds.internic.net/rfc/rfc1766.txt".
1472 HTML and Style Sheets
1473 Associating HTML3 documents with Rendering Information, by Bert
1474 Bos, Dave Raggett and Hakon Lie. This document can be downloaded
1475 from: "http://www.w3.org/pub/WWW/TR/WD-style.html"
1477 -----------------------------------------------------------------------
1478 The World Wide Web Consortium: http://www.w3.org/
|