1 |
|
2 |
HTML Tables 03 Oct 95 |
3 |
|
4 |
INTERNET DRAFT Dave Raggett, W3C |
5 |
Expires in six months email: <dsr@w3.org> |
6 |
|
7 |
HTML Tables |
8 |
|
9 |
<draft-ietf-html-tables-01.txt> |
10 |
|
11 |
Status of this Memo |
12 |
|
13 |
This document is an Internet draft. Internet drafts are working |
14 |
documents of the Internet Engineering Task Force (IETF), its areas |
15 |
and its working groups. Note that other groups may also distribute |
16 |
working information as Internet drafts. |
17 |
|
18 |
Internet Drafts are draft documents valid for a maximum of six |
19 |
months and can be updated, replaced or obsoleted by other documents |
20 |
at any time. It is inappropriate to use Internet drafts as reference |
21 |
material or to cite them as other than as "work in progress". |
22 |
|
23 |
To learn the current status of any Internet draft please check the |
24 |
"lid-abstracts.txt" listing contained in the Internet drafts shadow |
25 |
directories on ftp.is.co.za (Africa), nic.nordu.net (Europe), |
26 |
munnari.oz.au (Pacific Rim), ds.internic.net (US East coast) or |
27 |
ftp.isi.edu (US West coast). Further information about the IETF can |
28 |
be found at URL: http://www.cnri.reston.va.us/ |
29 |
|
30 |
Distribution of this document is unlimited. Please send comments to |
31 |
the HTML working group (HTML-WG) of the Internet Engineering Task |
32 |
Force (IETF) at <html-wg@oclc.org>. Discussions of this group are |
33 |
archived at URL: http://www.acl.lanl.gov/HTML-WG/archives.html. |
34 |
|
35 |
Abstract |
36 |
|
37 |
The HyperText Markup Language (HTML) is a simple markup language |
38 |
used to create hypertext documents that are portable from one |
39 |
platform to another. HTML documents are SGML documents with generic |
40 |
semantics that are appropriate for representing information from a |
41 |
wide range of applications. This specification extends HTML to |
42 |
support a wide variety of tables. The model is designed to work well |
43 |
with associated style sheets, but does not require them. It also |
44 |
supports rendering to braille, or speech, and exchange of tabular |
45 |
data with databases and spreadsheets. The html table model embodies |
46 |
certain aspects of the CALS table model, e.g. the ability to group |
47 |
table rows into thead, tbody and tfoot sections, plus the ability to |
48 |
specify cell alignment compactly for sets of cells according to the |
49 |
context. |
50 |
|
51 |
------------------------------------------------------------------------------ |
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
Dave Raggett Page 1 |
59 |
|
60 |
|
61 |
|
62 |
HTML Tables 03 Oct 95 |
63 |
|
64 |
Contents |
65 |
|
66 |
* Recent Changes .................................................... 2 |
67 |
|
68 |
* Brief Introduction ................................................ 3 |
69 |
|
70 |
* Design Rationale .................................................. 5 |
71 |
|
72 |
* Walkthrough of the Table DTD ...................................... 7 |
73 |
|
74 |
* Recommended Layout Algorithms .................................... 18 |
75 |
|
76 |
* The Table DTD .................................................... 21 |
77 |
|
78 |
* References ....................................................... 24 |
79 |
|
80 |
Recent Changes |
81 |
|
82 |
This specification extends HTML to support tables. The table model |
83 |
has grown out of early work on HTML+ and the initial draft of HTML3. |
84 |
The earlier model has been been extended in response to requests |
85 |
from information providers for improved control over the |
86 |
presentation of tabular information: |
87 |
|
88 |
* alignment on designated characters such as "." and ":" |
89 |
e.g. aligning a column of numbers on the decimal point |
90 |
|
91 |
* more flexibility in specifying table frames and rules |
92 |
|
93 |
* incremental display for large tables as data is received |
94 |
|
95 |
* the ability to support scrollable tables with fixed headers plus |
96 |
better support for breaking tables across pages for printing |
97 |
|
98 |
* optional column based defaults for alignment properties |
99 |
|
100 |
In addition, a major goal has been to provide backwards |
101 |
compatibility with the widely deployed Netscape implementation of |
102 |
tables. A subsidiary goal has been to simplify importing tables |
103 |
conforming to the SGML CALS model. |
104 |
|
105 |
------------------------------------------------------------------------------ |
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
Dave Raggett Page 2 |
119 |
|
120 |
|
121 |
|
122 |
HTML Tables 03 Oct 95 |
123 |
|
124 |
A Brief Introduction to HTML Tables |
125 |
|
126 |
Tables start with an optional caption followed by one or more rows. |
127 |
Each row is formed by one or more cells, which are differentiated |
128 |
into header and data cells. Cells can be merged across rows and |
129 |
columns, and include attributes assisting rendering to speech and |
130 |
braille, or for exporting table data into databases. The model |
131 |
provides limited support for control over appearence, for example |
132 |
horizontal and vertical alignment of cell contents, border styles |
133 |
and cell margins. You can further affect this by grouping rows and |
134 |
columns together. Tables can contain a wide range of content, such |
135 |
as headers, lists, paragraphs, forms, figures, preformatted text and |
136 |
even nested tables. |
137 |
|
138 |
Example |
139 |
|
140 |
<TABLE BORDER> |
141 |
<CAPTION>A test table with merged cells</CAPTION> |
142 |
<TR><TH ROWSPAN=2><TH COLSPAN=2>Average |
143 |
<TH ROWSPAN=2>other<BR>category<TH>Misc |
144 |
<TR><TH>height<TH>weight |
145 |
<TR><TH ALIGN=LEFT>males<TD>1.9<TD>0.003 |
146 |
<TR><TH ALIGN=LEFT ROWSPAN=2>females<TD>1.7<TD>0.002 |
147 |
</TABLE> |
148 |
|
149 |
On a dumb terminal, this would be rendered something like: |
150 |
|
151 |
A test table with merged cells |
152 |
/--------------------------------------------------\ |
153 |
| | Average | other | Misc | |
154 |
| |-------------------| category |--------| |
155 |
| | height | weight | | | |
156 |
|-----------------------------------------|--------| |
157 |
| males | 1.9 | 0.003 | | | |
158 |
|-----------------------------------------|--------| |
159 |
| females | 1.7 | 0.002 | | | |
160 |
\--------------------------------------------------/ |
161 |
|
162 |
|
163 |
Next, a richer example with grouped rows and columns (adapted from |
164 |
"Developing International Software" by Nadine Kano). First here is |
165 |
what the table looks like on paper: |
166 |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 |
|
172 |
|
173 |
|
174 |
|
175 |
|
176 |
|
177 |
|
178 |
Dave Raggett Page 3 |
179 |
|
180 |
|
181 |
|
182 |
HTML Tables 03 Oct 95 |
183 |
|
184 |
|
185 |
|
186 |
CODE-PAGE SUPPORT IN MICROSOFT WINDOWS |
187 |
=============================================================================== |
188 |
Code-Page | Name | ACP OEMCP | Windows Windows Windows |
189 |
ID | | | NT 3.1 NT 3.51 95 |
190 |
------------------------------------------------------------------------------- |
191 |
1200 | Unicode (BMP of ISO 10646) | | X X * |
192 |
1250 | Windows 3.1 Eastern European | X | X X X |
193 |
1251 | Windows 3.1 Cyrillic | X | X X X |
194 |
1252 | Windows 3.1 US (ANSI) | X | X X X |
195 |
1253 | Windows 3.1 Greek | X | X X X |
196 |
1254 | Windows 3.1 Turkish | X | X X X |
197 |
1255 | Hebrew | X | X |
198 |
1256 | Arabic | X | X |
199 |
1257 | Baltic | X | X |
200 |
1361 | Korean (Johab) | X | ** X |
201 |
------------------------------------------------------------------------------- |
202 |
437 | MS-DOS United States | X | X X X |
203 |
708 | Arabic (ASMO 708) | X | X |
204 |
709 | Arabic (ASMO 449+, BCON V4) | X | X |
205 |
710 | Arabic (Transparent Arabic) | X | X |
206 |
720 | Arabic (Transparent ASMO) | X | X |
207 |
=============================================================================== |
208 |
|
209 |
|
210 |
The markup for this uses COL elements to group columns and set |
211 |
column alignment. TBODY elements are used to group rows. The FRAME |
212 |
and RULES attributes are used to select which borders to render. |
213 |
|
214 |
|
215 |
<table border=2 frame=topbot rules=cols> |
216 |
<caption>CODE-PAGE SUPPORT IN MICROSOFT WINDOWS</caption> |
217 |
<col align=center> |
218 |
<col align=left> |
219 |
<col align=center span=2> |
220 |
<col align=center span=3> |
221 |
<thead valign=top> |
222 |
<tr> |
223 |
<th>Code-Page<br>ID |
224 |
<th>Name |
225 |
<th>ACP |
226 |
<th>OEMCP |
227 |
<th>Windows<br>NT 3.1 |
228 |
<th>Windows<br>NT 3.51 |
229 |
<th>Windows<br>95 |
230 |
<tbody> |
231 |
<tr><td>1200<td>Unicode (BMP of ISO 10646)<td><td><td>X<td>X<TD>* |
232 |
<tr><td>1250<td>Windows 3.1 Eastern European<td>X<td><td>X<td>X<TD>X |
233 |
<tr><td>1251<td>Windows 3.1 Cyrillic<td>X<td><td>X<td>X<TD>X |
234 |
<tr><td>1252<td>Windows 3.1 US (ANSI)<td>X<td><td>X<td>X<TD>X |
235 |
<tr><td>1253<td>Windows 3.1 Greek<td>X<td><td>X<td>X<TD>X |
236 |
<tr><td>1254<td>Windows 3.1 Turkish<td>X<td><td>X<td>X<TD>X |
237 |
|
238 |
Dave Raggett Page 4 |
239 |
|
240 |
|
241 |
|
242 |
HTML Tables 03 Oct 95 |
243 |
|
244 |
<tr><td>1255<td>Hebrew<td>X<td><td><td><td>X |
245 |
<tr><td>1256<td>Arabic<td>X<td><td><td><td>X |
246 |
<tr><td>1257<td>Baltic<td>X<td><td><td><td>X |
247 |
<tr><td>1361<td>Korean (Johab)<td>X<td><td><td>**<td>X |
248 |
<tbody> |
249 |
<tr><td>437<td>MS-DOS United States<td><td>X<td>X<td>X<TD>X |
250 |
<tr><td>708<td>Arabic (ASMO 708)<td><td>X<td><td><td>X |
251 |
<tr><td>709<td>Arabic (ASMO 449+, BCON V4)<td><td>X<td><td><td>X |
252 |
<tr><td>710<td>Arabic (Transparent Arabic)<td><td>X<td><td><td>X |
253 |
<tr><td>720<td>Arabic (Transparent ASMO)<td><td>X<td><td><td>X |
254 |
</table> |
255 |
|
256 |
|
257 |
------------------------------------------------------------------------------ |
258 |
Design Rationale |
259 |
|
260 |
The HTML table model has evolved from studies of existing SGML |
261 |
tables models, the treatment of tables in common word processing |
262 |
packages, and looking at a wide range of tabular layout in |
263 |
magazines, books and other paper-based documents. The model was |
264 |
chosen to allow simple tables to be expressed simply with extra |
265 |
complexity only when needed. This makes it practical to create the |
266 |
markup for HTML tables with everyday text editors and reduces the |
267 |
learning curve for getting started. This feature has been very |
268 |
important to the success of HTML to date. |
269 |
|
270 |
Increasingly people are using filters from other document formats or |
271 |
direct wysiwyg editors for HTML. It is important that the HTML table |
272 |
model fits well with these routes for authoring HTML. This affects |
273 |
how the representation handles cells which span multiple rows or |
274 |
columns, and how alignment and other presentation properties are |
275 |
associated with groups of cells. |
276 |
|
277 |
A major consideration for the HTML table model is that the fonts and |
278 |
window sizes etc. in use with browsers are not under the author's |
279 |
control. This makes it risky to rely on column widths specified in |
280 |
terms of absolute units such as picas or pixels. Instead, tables can |
281 |
be dynamically sized to match the current window size and fonts. |
282 |
Authors can provide guidance as to the relative widths of columns, |
283 |
but user agents should to ensure that columns are wide enough to |
284 |
avoid clipping cell contents. |
285 |
|
286 |
For large tables or slow network connections, it is desirable to be |
287 |
able to start displaying the table before all of the data has been |
288 |
received. The default window width for most user agents shows about |
289 |
80 characters, and the graphics for many HTML pages are designed |
290 |
with these defaults in mind. Authors can provide a hint to user |
291 |
agents to activate incremental display of table contents. This |
292 |
feature requires the author to specify the number of columns, and |
293 |
includes provision for control of table width and the relative |
294 |
widths of different columns. |
295 |
|
296 |
|
297 |
|
298 |
Dave Raggett Page 5 |
299 |
|
300 |
|
301 |
|
302 |
HTML Tables 03 Oct 95 |
303 |
|
304 |
|
305 |
For incremental display, the browser needs the number of columns and |
306 |
their widths. The default width of the table is the current window |
307 |
size (width="100%"). This can be altered by including a WIDTH |
308 |
attribute in the TABLE start tag. By default all columns have the |
309 |
same width, but you can specify column widths with one or more COL |
310 |
elements before the table data starts. |
311 |
|
312 |
The remaining issue is the number of columns. Some people have |
313 |
suggested waiting until the first row of the table has been |
314 |
received, but this could take a long time if the cells have a lot of |
315 |
content. On the whole it makes more sense, when incremental display |
316 |
is desired, to get authors to explicitly specify the number of |
317 |
columns in the TABLE start tag. |
318 |
|
319 |
Authors still need a way of informing the browser whether to use |
320 |
incremental display or to automatically size the table to match the |
321 |
cell contents. For the two pass auto sizing mode, the number of |
322 |
columns is determined by the first pass, while for the incremental |
323 |
mode, the number of columns needs to be stated up front. So it seems |
324 |
to that the COLS=--nn-- would be better for this purpose, than a |
325 |
LAYOUT attribute such as LAYOUT=FIXED or LAYOUT=AUTO. |
326 |
|
327 |
It is generally held useful to consider documents from two |
328 |
perspectives: Structural idioms such as headers, paragraphs, lists, |
329 |
tables, and figures; and rendering idioms such as margins, leading, |
330 |
font names and sizes. The wisdom of past experience encourages us to |
331 |
separate the structural information of documents from rendering |
332 |
information. Mixing them together ends up causing increased cost of |
333 |
ownership for maintaining documents, and reduced portability between |
334 |
applications and media. |
335 |
|
336 |
For tables, the alignment of text within table cells, and the |
337 |
borders between cells are, from the purist's point of view, |
338 |
rendering information. In practice, though, it is useful to group |
339 |
these with the structural information, as these features are highly |
340 |
portable from one application to the next. The HTML table model |
341 |
leaves most rendering information to associated style sheets. The |
342 |
model is designed to take advantage of such style sheets but not to |
343 |
require them. |
344 |
|
345 |
This specification provides a superset of the simpler model |
346 |
presented in earlier work on HTML+. Tables are considered as being |
347 |
formed from an optional caption together with a sequence of rows, |
348 |
which in turn consist of a sequence of table cells. The model |
349 |
further differentiates header and data cells, and allows cells to |
350 |
span multiple rows and columns. |
351 |
|
352 |
Following the CALS table model, this specification allows table rows |
353 |
to be grouped into head and body and foot sections. This simplifies |
354 |
the representation of rendering information and can be used to |
355 |
repeat table head and foot rows when breaking tables across page |
356 |
boundaries, or to provide fixed headers above a scrollable body |
357 |
|
358 |
Dave Raggett Page 6 |
359 |
|
360 |
|
361 |
|
362 |
HTML Tables 03 Oct 95 |
363 |
|
364 |
panel. In the markup, the foot section is placed before the body |
365 |
sections. This is an optimization shared with CALS for dealing with |
366 |
very long tables. It allows the foot to be rendered without having |
367 |
to wait for the entire table to be processed. |
368 |
|
369 |
For the visually impaired, HTML offers the hope of setting to rights |
370 |
the damage caused by the adoption of windows based graphical user |
371 |
interfaces. The HTML table model includes attributes for labeling |
372 |
each cell, to support high quality text to speech conversion. The |
373 |
same attributes can also be used to support automated import and |
374 |
export of table data to databases or spreadsheets. |
375 |
|
376 |
This specification allows authors to define groups of columns along |
377 |
with column based alignment properties. A simple inheritance |
378 |
mechanism defines the precedence order for determining applicable |
379 |
values for alignment for each cell. |
380 |
|
381 |
Current desktop publishing packages provide very rich control over |
382 |
the rendering of tables, and it would be impractical to reproduce |
383 |
this in HTML, without making HTML into a bulky rich text format like |
384 |
RTF or MIF. This specification does, however, offer authors the |
385 |
ability to choose from a set of commonly used classes of border |
386 |
styles. The BORDER attribute controls the appearence of the border |
387 |
frame around the table while the RULES attribute determines the |
388 |
choice of rulings within the table. A finer level of control will be |
389 |
possible via style sheets. |
390 |
|
391 |
------------------------------------------------------------------------------ |
392 |
A walk through the table DTD |
393 |
|
394 |
The table document type definition provides the formal definition of |
395 |
the allowed syntax for html tables. The following is an annotated |
396 |
listing of the DTD. The complete listing appears at the end of this |
397 |
document. |
398 |
|
399 |
Note that the TABLE element is a block-like element rather a |
400 |
character-level element. As such it is a peer of other HTML |
401 |
block-like elements such as paragraphs, lists and headers. |
402 |
|
403 |
Common Attributes |
404 |
|
405 |
The following attributes occur in several of the elements and are |
406 |
defined here for brevity. In general, all attribute names and values |
407 |
in this specification are case insensitive, except where noted |
408 |
otherwise. |
409 |
|
410 |
|
411 |
<!ENTITY % attrs |
412 |
"id ID #IMPLIED -- element identifier -- |
413 |
class NAMES #IMPLIED -- used with style sheets -- |
414 |
lang NAME #IMPLIED -- as per RFC 1766 --"> |
415 |
|
416 |
|
417 |
|
418 |
Dave Raggett Page 7 |
419 |
|
420 |
|
421 |
|
422 |
HTML Tables 03 Oct 95 |
423 |
|
424 |
ID |
425 |
Used to define a document-wide identifier. This can be used for |
426 |
naming positions within documents as the destination of a |
427 |
hypertext link. It may also be used by style sheets for |
428 |
rendering an element in a unique style. An ID attribute value is |
429 |
an SGML NAME token. NAME tokens are formed by an initial letter |
430 |
followed by letters, digits, "-" and "." characters. The letters |
431 |
are restricted to A-Z and a-z. |
432 |
|
433 |
CLASS |
434 |
A space separated list of SGML NAME tokens. CLASS names specify |
435 |
that the element belongs to the corresponding named classes. |
436 |
These may be used by style sheets to provide class dependent |
437 |
renderings. |
438 |
|
439 |
LANG |
440 |
A LANG attribute identifies the natural language used by the |
441 |
content of the associated element.The syntax and registry of |
442 |
language values are defined by RFC 1766. In summary the language |
443 |
is given as a primary tag followed by zero or more subtags, |
444 |
separated by "-". White space is not allowed and all tags are |
445 |
case insensitive. The name space of tags is administered by |
446 |
IANA. The two letter primary tag is an ISO 639 language |
447 |
abbreviation, while the initial subtag is a two letter ISO 3166 |
448 |
country code. Example values for LANG include: |
449 |
|
450 |
en, en-US, en-uk, i-cherokee, x-pig-latin. |
451 |
|
452 |
DIR |
453 |
This specifies an override to the base direction for laying out |
454 |
text as determined from the language context (see LANG |
455 |
attribute). The attribute value is either DIR=LTR for left to |
456 |
right or DIR=RTL for right to left rendering of text. The value |
457 |
is case insensitive. The attribute sets the base direction for |
458 |
the text for this element and is overridden by directives within |
459 |
the content, e.g. by LANG and DIR attributes on nested elements. |
460 |
|
461 |
------------------------------------------------------------------------------ |
462 |
Horizontal and Vertical Alignment Attributes |
463 |
|
464 |
The alignment of cell contents can be specified on a cell by cell |
465 |
basis, or inherited from enclosing elements, such as the row, column |
466 |
or the table element itself. |
467 |
|
468 |
ALIGN |
469 |
This specifies the horizontal alignment of cell contents. |
470 |
|
471 |
<!-- horizontal alignment attributes for cell contents --> |
472 |
<!ENTITY % cell.halign |
473 |
"align (left|center|right|justify|char) #IMPLIED |
474 |
char CDATA #IMPLIED -- alignment char, e.g. char=':' -- |
475 |
charoff NUTOKEN 50 -- % offset for alignment char --" |
476 |
> |
477 |
|
478 |
Dave Raggett Page 8 |
479 |
|
480 |
|
481 |
|
482 |
HTML Tables 03 Oct 95 |
483 |
|
484 |
|
485 |
The attribute value should be one of LEFT, CENTER, RIGHT, |
486 |
JUSTIFY and CHAR. User agents may treat JUSTIFY as left |
487 |
alignment if they lack support for text justification. |
488 |
ALIGN=CHAR is used for aligning cell contents on a particular |
489 |
character. |
490 |
|
491 |
For cells spanning multiple rows or columns, where the alignment |
492 |
property is inherited from the row or column, the initial row |
493 |
and column for the cell determines the appropriate alignment |
494 |
property to use. |
495 |
|
496 |
Note that an alignment attribute on elements within the cell, |
497 |
e.g. on a P element, overrides the normal alignment value for |
498 |
the cell. |
499 |
|
500 |
CHAR |
501 |
This is used to specify an alignment character for use with |
502 |
align=char, e.g. char=":". The default character is the decimal |
503 |
point for the current language, as set by the LANG attribute. |
504 |
The CHAR attribute value is case sensitive. |
505 |
|
506 |
CHAROFF |
507 |
An integer value that defines the offset to the alignment |
508 |
character as a percentage of the cell width, e.g. charoff=70. |
509 |
The default value is charoff=50, i.e. midway through the cell. |
510 |
|
511 |
Only the first occurence of the alignment character is |
512 |
significant for alignment purposes. If a line doesn't include |
513 |
the alignment character, it should be horizontally shifted to |
514 |
end at the alignment position. |
515 |
|
516 |
Note that this applies whether the text is displayed left to |
517 |
right, or right to left. If several cells in different rows for |
518 |
the same column use character alignment, then all such cells |
519 |
should line up, regardless of which character is used for |
520 |
alignment. |
521 |
|
522 |
VALIGN |
523 |
Defines whether the cell contents are aligned with the top, |
524 |
middle or bottom of the cell. |
525 |
|
526 |
<!-- vertical alignment attributes for cell contents --> |
527 |
<!ENTITY % cell.valign |
528 |
"valign (top|middle|bottom) #IMPLIED" |
529 |
> |
530 |
|
531 |
If present, the value of the attribute should be one of: TOP, |
532 |
MIDDLE, BOTTOM or BASELINE. All cells in the same row with |
533 |
valign=baseline should be vertically positioned so that the |
534 |
first text line in each such cell occur on a common baseline. |
535 |
This constraint does not apply to subsequent text lines in these |
536 |
cells. |
537 |
|
538 |
Dave Raggett Page 9 |
539 |
|
540 |
|
541 |
|
542 |
HTML Tables 03 Oct 95 |
543 |
|
544 |
|
545 |
Inheritance Order |
546 |
|
547 |
Alignment properties can be included with most of the table |
548 |
elements: COL, THEAD, TBODY, TFOOT, TR, TH and TD. When rendering |
549 |
cells, horizontal alignment is determined by columns in preference |
550 |
to rows, while for vertical alignment, the rows are more important |
551 |
than the columns. The following table gives the detailed precedence |
552 |
order for each attribute: |
553 |
|
554 |
|
555 |
ALIGN (TH|TD) < COL < TR < (THEAD|TBODY|TFOOT) < default |
556 |
VALIGN (TH|TD) < TR < (THEAD|TBODY|TFOOT) < COL < default |
557 |
LANG (TH|TD) < TR < (THEAD|TBODY|TFOOT) < COL < TABLE < default |
558 |
|
559 |
|
560 |
Properties defined on cells take precedence over inherited |
561 |
properties, but are in turn over-ridden by alignment properties on |
562 |
elements within cells. In the absence of an ALIGN attribute along |
563 |
the inheritance path, the recommended default alignment for table |
564 |
cell contents is ALIGN=LEFT for table data and ALIGN=CENTER for |
565 |
table headers. The recommended default for vertical alignment is |
566 |
VALIGN=MIDDLE. |
567 |
|
568 |
------------------------------------------------------------------------------ |
569 |
Standard Units for Widths |
570 |
|
571 |
Several attributes specify widths as a number followed by an |
572 |
optional suffix. The units for widths are specified by the suffix: |
573 |
pt denotes points, pi denotes picas, in denotes inches, cm denotes |
574 |
centimeters, mm denotes millimeters, em denotes em units (equal to |
575 |
the height of the default font), and px denotes screen pixels. The |
576 |
default units are screen pixels. The number is an integer value or a |
577 |
real valued number such as "2.5". Exponents, as in "1.2e2", are not |
578 |
allowed. White space is not allowed between the number and the |
579 |
suffix. |
580 |
|
581 |
------------------------------------------------------------------------------ |
582 |
The TABLE element |
583 |
|
584 |
<!ELEMENT table - - (caption?, col*, thead?, tfoot?, tbody+)> |
585 |
|
586 |
<!ATTLIST table -- table element -- |
587 |
%attrs; -- id, lang, class -- |
588 |
float (left|right) #IMPLIED -- relative to window -- |
589 |
width CDATA #IMPLIED -- table width relative to window -- |
590 |
cols NUMBER #IMPLIED -- used for immediate display mode -- |
591 |
border CDATA #IMPLIED -- controls frame width around table -- |
592 |
frame %Frame; #IMPLIED -- which parts of table frame to include -- |
593 |
rules %Rules; #IMPLIED -- controls rules between cells -- |
594 |
cellspacing NUMBER #IMPLIED -- spacing between cells -- |
595 |
cellpadding NUMBER #IMPLIED -- spacing within cells -- |
596 |
> |
597 |
|
598 |
Dave Raggett Page 10 |
599 |
|
600 |
|
601 |
|
602 |
HTML Tables 03 Oct 95 |
603 |
|
604 |
|
605 |
The TABLE element requires both start and end tags. Table elements |
606 |
start with an optional CAPTION element, optionally followed by one |
607 |
or more COL elements, then an optional THEAD, an optional TFOOT, and |
608 |
finally one or more TBODY elements. |
609 |
|
610 |
------------------------------------------------------------------------------ |
611 |
ID, LANG and CLASS |
612 |
See earlier description of common attributes. |
613 |
|
614 |
FLOAT |
615 |
Defines whether the table is part of the main text flow or, |
616 |
whether it floats to the left (FLOAT=LEFT) or right |
617 |
(FLOAT=RIGHT), with the main text flow continuing around it. The |
618 |
default is deliberately unspecified. --The attribute is named |
619 |
FLOAT to distinguish it from the ALIGN attribute, which is used |
620 |
for setting the default horizontal alignment of cell contents.-- |
621 |
|
622 |
WIDTH |
623 |
Specifies the desired width of the table. In addition to the |
624 |
standard units, the "%" sign may used to indicate that the width |
625 |
specifies the percentage width of the space between the current |
626 |
left and right margins, e.g. width="50%". |
627 |
|
628 |
It is recommended that the table width be increased beyond the |
629 |
value indicated by the WIDTH attribute as needed to avoid |
630 |
clipping of cell contents. In the absence of this attribute, the |
631 |
table width can be determined by the layout algorithm given |
632 |
later on. |
633 |
|
634 |
COLS |
635 |
Specifies the number of columns for the table. If present the |
636 |
user agent may render the table dynamically as data is received |
637 |
from the network without waiting for the complete table to be |
638 |
received. If the WIDTH attribute is missing, a default of "100%" |
639 |
may be assumed for this purpose. If the COLS attribute is |
640 |
absent, a prepass through the table's contents is needed to |
641 |
determine the number of columns together with suitable values |
642 |
for the widths of each column. |
643 |
|
644 |
BORDER |
645 |
Specifies the width of the border framing the the table, see |
646 |
standard units. |
647 |
|
648 |
FRAME |
649 |
Specifies which sides of the frame to render. |
650 |
|
651 |
<!ENTITY % Frame "(none|top|bottom|topbot|sides|all|border)"> |
652 |
|
653 |
NONE (the default, but see below) |
654 |
Don't render any parts of the frame. |
655 |
|
656 |
TOP |
657 |
|
658 |
Dave Raggett Page 11 |
659 |
|
660 |
|
661 |
|
662 |
HTML Tables 03 Oct 95 |
663 |
|
664 |
The top part of the frame |
665 |
|
666 |
BOTTOM |
667 |
The bottom part of the frame |
668 |
|
669 |
TOPBOT |
670 |
The top and bottom parts of the frame |
671 |
|
672 |
SIDES |
673 |
The left and right sides of the frame |
674 |
|
675 |
ALL |
676 |
All four parts of the frame |
677 |
|
678 |
BORDER |
679 |
All four parts of the frame |
680 |
|
681 |
These values are compatible with the CALS table model with the |
682 |
exception of "border" which has been added for backwards |
683 |
compatibility with deployed browsers. If a document includes |
684 |
<TABLE BORDER> the user agent will see FRAME=BORDER and |
685 |
BORDER=--implied--. If the document includes <TABLE |
686 |
BORDER=--n--> then the user agent should treat this as |
687 |
frame=border except if --n=0-- for which FRAME=NONE is appropriate. |
688 |
|
689 |
|
690 |
RULES |
691 |
Specifies where to place rules within the table. |
692 |
|
693 |
<!ENTITY % Rules "(none | basic | rows | cols | all)"> |
694 |
|
695 |
NONE (the default if BORDER is absent or BORDER=0) |
696 |
The table should be rendered without any internal rulings. |
697 |
|
698 |
BASIC |
699 |
The THEAD, TFOOT and TBODY elements divide the table into |
700 |
groups of rows. This choice places a horizontal rule between |
701 |
each such group. |
702 |
|
703 |
ROWS |
704 |
Place horizontal rules between all rows. User agents may |
705 |
choose to use a heavier rule between groups of rows for |
706 |
emphasis. |
707 |
|
708 |
COLS |
709 |
Place vertical rules between groups of columns as defined by |
710 |
COL elements, plus horizontal rules between row groups (see |
711 |
rules=basic). |
712 |
|
713 |
ALL (default if BORDER=--n-- and --n-- is non-zero) |
714 |
Place rules between all rows and all columns. User agents |
715 |
may choose to use a heavier rule between groups of rows and |
716 |
columns for emphasis. |
717 |
|
718 |
Dave Raggett Page 12 |
719 |
|
720 |
|
721 |
|
722 |
HTML Tables 03 Oct 95 |
723 |
|
724 |
|
725 |
CELLSPACING |
726 |
Specifies the space between individual cells in a table. See |
727 |
standard units. |
728 |
|
729 |
CELLPADDING |
730 |
Specifies the amount of space between the border of the cell and |
731 |
its contents. See standard units. |
732 |
|
733 |
------------------------------------------------------------------------------ |
734 |
Table Captions |
735 |
|
736 |
|
737 |
<!ELEMENT caption - - (%text;)+> |
738 |
|
739 |
<!ENTITY % Caption "(top|bottom|left|right)"> |
740 |
|
741 |
<!ATTLIST caption -- table caption -- |
742 |
%attrs; -- id, lang, class -- |
743 |
align %Caption; #IMPLIED -- relative to table -- |
744 |
> |
745 |
|
746 |
|
747 |
The optional CAPTION element is used to provide a caption for the |
748 |
table. Both start and end tags are required. |
749 |
|
750 |
ID, LANG and CLASS |
751 |
See earlier description of common attributes. |
752 |
|
753 |
ALIGN |
754 |
This may be used to control the placement of captions relative |
755 |
to the table. When present, the ALIGN attribute should have one |
756 |
of the values: TOP, BOTTOM, LEFT and RIGHT. It is recommended |
757 |
that the caption is made to fit within the width or height of |
758 |
the table as appropriate. The default position of the caption is |
759 |
deliberately unspecified. |
760 |
|
761 |
--The ALIGN attribute is overused in HTML, but is retained here |
762 |
for compatibility with currently deployed browsers.-- |
763 |
|
764 |
------------------------------------------------------------------------------ |
765 |
The COL Element |
766 |
|
767 |
|
768 |
<!ELEMENT col - O EMPTY> |
769 |
|
770 |
<!ATTLIST col -- column groups and properties -- |
771 |
%attrs; -- id, lang, class -- |
772 |
span NUMBER 1 -- number of columns spanned by group -- |
773 |
width CDATA #IMPLIED -- relative width e.g. width="2.5*" -- |
774 |
%cell.halign; -- horizontal alignment in cells -- |
775 |
%cell.valign; -- vertical alignment in cells -- |
776 |
> |
777 |
|
778 |
Dave Raggett Page 13 |
779 |
|
780 |
|
781 |
|
782 |
HTML Tables 03 Oct 95 |
783 |
|
784 |
|
785 |
|
786 |
This optional element is used to specify column based defaults for |
787 |
table properties. It is an empty element, and as such has no |
788 |
content, and shouldn't be given an end tag. Several COL elements may |
789 |
be given in succession. |
790 |
|
791 |
ID, LANG and CLASS |
792 |
See earlier description of common attributes. |
793 |
|
794 |
SPAN |
795 |
A positive integer value that specifies how many columns this |
796 |
element applies to, defaulting to one. In the absence of SPAN |
797 |
attributes the first COL element applies to the first column, |
798 |
the second COL element to the second column and so on. If the |
799 |
second COL element had span=2, it would apply to the second and |
800 |
third column. The next COL element would then apply to the |
801 |
fourth column and so on. SPAN=0 has a special significance and |
802 |
implies that the COL element spans all columns from the current |
803 |
column up to and including the last column. |
804 |
|
805 |
WIDTH |
806 |
Specifies the width of the columns, see standard units. In |
807 |
addition, the "*" suffix denotes relative widths, e.g. |
808 |
|
809 |
|
810 |
width=64 width in screen pixels |
811 |
width=0.5* a relative width of 0.5 |
812 |
|
813 |
|
814 |
Relative widths act as constraints on the relative widths of |
815 |
different columns. When widths are given in absolute units, the |
816 |
user agent can use these to constrain the width of the table. |
817 |
|
818 |
--Percentage widths are inappropriate as you would need to check |
819 |
that the numbers add up, and they would all have to be changed |
820 |
if a column was inserted or removed. The "*" suffix is used to |
821 |
simplify importing tables from the CALS representation.-- |
822 |
|
823 |
ALIGN, CHAR, CHAROFF and VALIGN |
824 |
Specify values for horizontal and vertical alignment within |
825 |
table cells. See inheritance order of alignment properties. |
826 |
|
827 |
------------------------------------------------------------------------------ |
828 |
Table Head, Foot and Body Elements |
829 |
|
830 |
|
831 |
<!ELEMENT thead - O tr+> |
832 |
<!ELEMENT tfoot - O tr+> |
833 |
<!ELEMENT tbody O O tr+> |
834 |
|
835 |
<!ATTLIST (thead|tbody) -- table section -- |
836 |
%attrs; -- id, lang, class -- |
837 |
|
838 |
Dave Raggett Page 14 |
839 |
|
840 |
|
841 |
|
842 |
HTML Tables 03 Oct 95 |
843 |
|
844 |
%cell.halign; -- horizontal alignment in cells -- |
845 |
%cell.valign; -- vertical alignment in cells -- |
846 |
> |
847 |
|
848 |
|
849 |
Tables may be divided up into head and body sections. The THEAD and |
850 |
TFOOT elements are optional, but one or more TBODY elements are |
851 |
always required. If the table only consists of a TBODY section, the |
852 |
TBODY start and end tags may be omitted, as the parser can infer |
853 |
them. If a THEAD element is present, the THEAD start tag is |
854 |
required, but the end tag can be omitted, provided a TFOOT or TBODY |
855 |
start tag follows. The same applies to TFOOT. --This definition |
856 |
provides compatibility with tables created for the older model, as |
857 |
well as allowing the end tags for THEAD, TFOOT and TBODY to be |
858 |
omitted.-- |
859 |
|
860 |
The THEAD, TFOOT and TBODY elements provide a convenient means for |
861 |
controlling rendering. If the table has a large number of rows in |
862 |
the body, user agents may choose to use a scrolling region for the |
863 |
table body sections. When rendering to a paged device, tables will |
864 |
often have to be broken across page boundaries. The THEAD, TFOOT and |
865 |
TBODY elements allow the user agent to repeat the table foot at the |
866 |
bottom of the current page, and then the table head at the top of |
867 |
the new page before continuing on with the table body. |
868 |
|
869 |
TFOOT is placed before the TBODY in the markup sequence, so that |
870 |
browsers can render the foot before receiving all of the table data. |
871 |
This is useful when very long tables are rendered with scrolling |
872 |
body sections, or for paged output, involving breaking the table |
873 |
over many pages. |
874 |
|
875 |
Each THEAD, TFOOT and TBODY element must contain one or more TR |
876 |
elements. |
877 |
|
878 |
ID, LANG and CLASS |
879 |
See earlier description of common attributes. |
880 |
|
881 |
ALIGN, CHAR, CHAROFF and VALIGN |
882 |
Specify values for horizontal and vertical alignment within |
883 |
table cells. See inheritance order of alignment properties. |
884 |
|
885 |
------------------------------------------------------------------------------ |
886 |
Table Row (TR) elements |
887 |
|
888 |
|
889 |
<!ELEMENT tr - O (th|td)+> |
890 |
|
891 |
<!ATTLIST tr -- table row -- |
892 |
%attrs; -- id, lang, class -- |
893 |
%cell.halign; -- horizontal alignment in cells -- |
894 |
%cell.valign; -- vertical alignment in cells -- |
895 |
> |
896 |
|
897 |
|
898 |
Dave Raggett Page 15 |
899 |
|
900 |
|
901 |
|
902 |
HTML Tables 03 Oct 95 |
903 |
|
904 |
|
905 |
The TR or table row element acts as a container for a row of table |
906 |
cells. The end tag may be omitted. |
907 |
|
908 |
ID, LANG and CLASS |
909 |
See earlier description of common attributes. |
910 |
|
911 |
ALIGN, CHAR, CHAROFF and VALIGN |
912 |
Specify values for horizontal and vertical alignment within |
913 |
table cells. See inheritance order of alignment properties. |
914 |
|
915 |
------------------------------------------------------------------------------ |
916 |
Table Cells: TH and TD |
917 |
|
918 |
|
919 |
<!ELEMENT (th|td) - O %body.content> |
920 |
|
921 |
<!ATTLIST (th|td) -- header or data cell -- |
922 |
%attrs; -- id, lang, class -- |
923 |
axis CDATA #IMPLIED -- defaults to cell content -- |
924 |
axes CDATA #IMPLIED -- list of axis names -- |
925 |
nowrap (nowrap) #IMPLIED -- suppress word wrap -- |
926 |
rowspan NUMBER 1 -- number of rows spanned by cell -- |
927 |
colspan NUMBER 1 -- number of cols spanned by cell -- |
928 |
%cell.halign; -- horizontal alignment in cells -- |
929 |
%cell.valign; -- vertical alignment in cells -- |
930 |
> |
931 |
|
932 |
|
933 |
TH elements are used to represent header cells, while TD elements |
934 |
are used to represent data cells. This allows user agents to render |
935 |
header and data cells distinctly, even in the absence of style |
936 |
sheets. |
937 |
|
938 |
Cells can span multiple rows and columns, and may be empty. Cells |
939 |
spanning rows contribute to the column count on each of the spanned |
940 |
rows, but only appear in the markup once (in the first row spanned). |
941 |
The row count is determined by the number of TR elements. Any rows |
942 |
implied by cells spanning rows beyond this should be ignored. |
943 |
|
944 |
If the column count for the table is greater than the number of |
945 |
cells for a given row (after including cells for spanned rows), the |
946 |
missing cells are treated as occurring on the right hand side of the |
947 |
table and rendered as empty cells. If the language context indicates |
948 |
a right to left writing order, then the missing cells should be |
949 |
placed on the left hand side. |
950 |
|
951 |
It is possible to create tables with overlapping cells, for |
952 |
instance: |
953 |
|
954 |
|
955 |
<table border> |
956 |
<tr><td rowspan=2>1<td>2<td>3 |
957 |
|
958 |
Dave Raggett Page 16 |
959 |
|
960 |
|
961 |
|
962 |
HTML Tables 03 Oct 95 |
963 |
|
964 |
<tr><td rowspan=2>4 |
965 |
<tr><td colspan=2>5<td>6 |
966 |
</table> |
967 |
|
968 |
|
969 |
which might look something like: |
970 |
|
971 |
/-----------\ |
972 |
| 1 | 2 | 3 | |
973 |
| |-------| |
974 |
| | 4 | | |
975 |
|---|...|---| |
976 |
| 5 : | 6 | |
977 |
\-----------/ |
978 |
|
979 |
In this example, the cells labelled 4 and 5 overlap. In such cases, |
980 |
the rendering is implementation dependent. |
981 |
|
982 |
The AXIS and AXES attributes for cells provide a means for defining |
983 |
concise labels for cells. When rendering to speech, these attributes |
984 |
may be used to provide abbreviated names for the headers relevant to |
985 |
each cell. Another application is when you want to be able to later |
986 |
process table contents to enter them into a database. These |
987 |
attributes are then used to give database field names. The table's |
988 |
class attribute should be used to let the software recognize which |
989 |
tables can be treated in this way. |
990 |
|
991 |
ID, LANG and CLASS |
992 |
See earlier description of common attributes. |
993 |
|
994 |
AXIS |
995 |
This defines an abbreviated name for a header cell, e.g. which |
996 |
can be used when rendering to speech. It defaults to the cell's |
997 |
content. |
998 |
|
999 |
AXES |
1000 |
This is a comma separated list of axis names which together |
1001 |
identify the row and column headers that pertain to this cell. |
1002 |
It is used for example when rendering to speech to identify the |
1003 |
cell's position in the table. If missing the user agent can try |
1004 |
to follow up columns and left along rows (right for some |
1005 |
languages) to find the corresponding header cells. |
1006 |
|
1007 |
NOWRAP, e.g. <TD NOWRAP> |
1008 |
The presence of this attribute disables automatic wrapping of |
1009 |
text lines for this cell. If used uncautiously, it may result in |
1010 |
excessively wide cells. |
1011 |
|
1012 |
ROWSPAN, e.g. <TD ROWSPAN=2> |
1013 |
A positive integer value that defines how may rows this cell |
1014 |
spans. The default ROWSPAN is 1. ROWSPAN=0 has a special |
1015 |
significance and implies that the cell spans all rows from the |
1016 |
current row up to the last row of the table. |
1017 |
|
1018 |
Dave Raggett Page 17 |
1019 |
|
1020 |
|
1021 |
|
1022 |
HTML Tables 03 Oct 95 |
1023 |
|
1024 |
|
1025 |
COLSPAN, e.g. <TD COLSPAN=2> |
1026 |
A positive integer value that defines how may columns this cell |
1027 |
spans. The default COLSPAN is 1. COLSPAN=0 has a special |
1028 |
significance and implies that the cell spans all columns from |
1029 |
the current column up to the last column of the table. |
1030 |
|
1031 |
ALIGN, CHAR, CHAROFF and VALIGN |
1032 |
Specify values for horizontal and vertical alignment within |
1033 |
table cells. See inheritance order of alignment properties. |
1034 |
|
1035 |
------------------------------------------------------------------------------ |
1036 |
Recommended Layout Algorithms |
1037 |
|
1038 |
If the COLS attribute on the TABLE element specifies the number of |
1039 |
columns, then the table may be rendered using a fixed layout, |
1040 |
otherwise the autolayout algorithm described below should be used. |
1041 |
|
1042 |
Fixed Layout Algorithm |
1043 |
|
1044 |
For this algorithm, it is assumed that the number of columns is |
1045 |
known. The column widths by default should be set to the same size. |
1046 |
Authors may override this by specifying relative or absolute column |
1047 |
widths, using the COL element. The default table width is the space |
1048 |
between the current left and right margins, but may be overridden by |
1049 |
the WIDTH attribute on the TABLE element, or determined from |
1050 |
absolute column widths. |
1051 |
|
1052 |
The table syntax alone is insufficient to guarantee the consistency |
1053 |
of attribute values. For instance, the number of columns specified |
1054 |
by the COLS attribute may be inconsistent with the number of columns |
1055 |
implied by the COL elements. This in turn, may be inconsistent with |
1056 |
the number of columns implied by the table cells. A further problem |
1057 |
occurs when the columns are too narrow to avoid clipping cell |
1058 |
contents. The width of the table as specified by the TABLE element |
1059 |
or COL elements may result in clipping of cell contents. It is |
1060 |
recommended that user agents attempt to recover gracefully from |
1061 |
these situations. |
1062 |
|
1063 |
Autolayout Algorithm |
1064 |
|
1065 |
If the COLS attribute is missing from the table start tag, then the |
1066 |
user agent should use the following autolayout algorithm. It uses |
1067 |
two passes through the table data and scales linearly with the size |
1068 |
of the table. |
1069 |
|
1070 |
In the first pass, line wrapping is disabled, and the user agent |
1071 |
keeps track of the minimum and maximum width of each cell. The |
1072 |
maximum width is given by the widest line. As line wrap has been |
1073 |
disabled, paragraphs are treated as long lines unless broken by <BR> |
1074 |
elements. The minimum width is given by the widest word or image |
1075 |
etc. taking into account leading indents and list bullets etc. In |
1076 |
other words, if you were to format the cell's content in a window of |
1077 |
|
1078 |
Dave Raggett Page 18 |
1079 |
|
1080 |
|
1081 |
|
1082 |
HTML Tables 03 Oct 95 |
1083 |
|
1084 |
its own, determine the minimum width you could make the window |
1085 |
before things begin to be clipped. |
1086 |
|
1087 |
To cope with character alignment of cell contents, the algorithm |
1088 |
keeps three running min/max totals for each column: Left of align |
1089 |
char, right of align char and un-aligned. The minimum width for a |
1090 |
column is then: max(min_left + min_right, min_non-aligned). |
1091 |
|
1092 |
The minimum and maximum cell widths are then used to determine the |
1093 |
corresponding minimum and maximum widths for the columns. These in |
1094 |
turn, are used to find the minimum and maximum width for the table. |
1095 |
Note that cells can contain nested tables, but this doesn't |
1096 |
complicate the code significantly. The next step is to assign column |
1097 |
widths according to the current window size (more accurately - the |
1098 |
width between the left and right margins). |
1099 |
|
1100 |
For cells which span multiple columns, a simple approach, as used by |
1101 |
Arena, is to evenly apportion the min/max widths to each of the |
1102 |
constituent columns. A slightly more complex approach is to use the |
1103 |
min/max widths of unspanned cells to weight how spanned widths are |
1104 |
apportioned. Experimental study suggests a blend of the two |
1105 |
approaches will give good results for a wide range of tables. |
1106 |
|
1107 |
The table borders and intercell margins need to be included in |
1108 |
assigning column widths. There are three cases: |
1109 |
|
1110 |
1. The minimum table width is equal to or wider than the available |
1111 |
space. In this case, assign the minimum widths and allow the |
1112 |
user to scroll horizontally. For conversion to braille, it will |
1113 |
be necessary to replace the cells by references to notes |
1114 |
containing their full content. By convention these appear before |
1115 |
the table. |
1116 |
|
1117 |
2. The maximum table width fits within the available space. In this |
1118 |
case, set the columns to their maximum widths. |
1119 |
|
1120 |
3. The maximum width of the table is greater than the available |
1121 |
space, but the minimum table width is smaller. In this case, |
1122 |
find the difference between the available space and the minimum |
1123 |
table width, lets call it W. Lets also call D the difference |
1124 |
between maximum and minimum width of the table. |
1125 |
|
1126 |
For each column, let d be the the difference between maximum and |
1127 |
minimum width of that column. Now set the column's width to the |
1128 |
minimum width plus d times W over D. This makes columns with |
1129 |
lots of text wider than columns with smaller amounts. |
1130 |
|
1131 |
This assignment step is then repeated for nested tables. In this |
1132 |
case, the width of the enclosing table's cell plays the role of the |
1133 |
current window size in the above description. This process is |
1134 |
repeated recursively for all nested tables. |
1135 |
|
1136 |
If the table width is specified with the WIDTH attribute, the user |
1137 |
|
1138 |
Dave Raggett Page 19 |
1139 |
|
1140 |
|
1141 |
|
1142 |
HTML Tables 03 Oct 95 |
1143 |
|
1144 |
agent attempts to set column widths to match. The WIDTH attribute is |
1145 |
not binding if this results in columns having less than their |
1146 |
minimum widths. |
1147 |
|
1148 |
If relative widths are specified with the COL element, the algorithm |
1149 |
is modified to increase column widths over the minimum width to meet |
1150 |
the relative width constraints. The COL elements should be taken as |
1151 |
hints only, so columns shouldn't be set to less than their minimum |
1152 |
width. Similarly, columns shouldn't be made so wide that the table |
1153 |
stretches well beyond the extent of the window. If a COL element |
1154 |
specifies a relative width of zero, the column should always be set |
1155 |
to its minimum width. |
1156 |
|
1157 |
------------------------------------------------------------------------------ |
1158 |
|
1159 |
|
1160 |
|
1161 |
|
1162 |
|
1163 |
|
1164 |
|
1165 |
|
1166 |
|
1167 |
|
1168 |
|
1169 |
|
1170 |
|
1171 |
|
1172 |
|
1173 |
|
1174 |
|
1175 |
|
1176 |
|
1177 |
|
1178 |
|
1179 |
|
1180 |
|
1181 |
|
1182 |
|
1183 |
|
1184 |
|
1185 |
|
1186 |
|
1187 |
|
1188 |
|
1189 |
|
1190 |
|
1191 |
|
1192 |
|
1193 |
|
1194 |
|
1195 |
|
1196 |
|
1197 |
|
1198 |
Dave Raggett Page 20 |
1199 |
|
1200 |
|
1201 |
|
1202 |
HTML Tables 03 Oct 95 |
1203 |
|
1204 |
HTML Table DTD |
1205 |
|
1206 |
The DTD or document type definition provides the formal definition |
1207 |
of the allowed syntax for html tables. |
1208 |
|
1209 |
<!-- The HTML Table DTD --> |
1210 |
|
1211 |
<!-- Content model entities imported from parent DTD: |
1212 |
|
1213 |
%body.content; allows table cells to contain headers, paras, |
1214 |
lists, form elements and even arbitrarily nested tables. |
1215 |
|
1216 |
%text; is text characters, including character entities and |
1217 |
character emphasis elements, IMG and anchors |
1218 |
--> |
1219 |
|
1220 |
<!ENTITY % attrs |
1221 |
"id ID #IMPLIED -- element identifier -- |
1222 |
class NAMES #IMPLIED -- used with style sheets -- |
1223 |
lang NAME #IMPLIED -- as per RFC 1766 --"> |
1224 |
|
1225 |
<!-- |
1226 |
The BORDER attribute sets the thickness of the frame around the |
1227 |
table. The default units are screen pixels. |
1228 |
|
1229 |
The FRAME attribute specifies which parts of the frame around |
1230 |
the table should be rendered. |
1231 |
|
1232 |
none no frame |
1233 |
top render only the top part of the frame |
1234 |
bottom render only the bottom part of the frame |
1235 |
topbot render both top and bottom parts |
1236 |
sides render both left and right parts |
1237 |
all render all four parts |
1238 |
border render all four parts |
1239 |
|
1240 |
The value "border" is chosen for backwards compatibility with |
1241 |
<TABLE BORDER> which yields frame=border and border=implied |
1242 |
For <TABLE BORDER=1> you get border=1 and frame=implied. In this |
1243 |
case, its appropriate to treat this as frame=border for backwards |
1244 |
compatibility with deployed browsers. |
1245 |
|
1246 |
The RULES attribute defines which rules to draw between cells: |
1247 |
|
1248 |
none no rules between cells |
1249 |
basic rule between thead/tbody and tbody/tbody |
1250 |
rows as per basic plus row separators |
1251 |
cols as per basic plus column group separators |
1252 |
all between all rows and all columns |
1253 |
|
1254 |
If RULES is absent then assume: |
1255 |
"none" if BORDER is absent or BORDER=0 otherwise "all" |
1256 |
--> |
1257 |
|
1258 |
Dave Raggett Page 21 |
1259 |
|
1260 |
|
1261 |
|
1262 |
HTML Tables 03 Oct 95 |
1263 |
|
1264 |
<!ENTITY % Frame "(none|top|bottom|topbot|sides|all|border)"> |
1265 |
|
1266 |
<!ENTITY % Rules "(none | basic | rows | cols | all)"> |
1267 |
|
1268 |
<!-- horizontal alignment attributes for cell contents --> |
1269 |
<!ENTITY % cell.halign |
1270 |
"align (left|center|right|justify|char) #IMPLIED |
1271 |
char CDATA #IMPLIED -- alignment char, e.g. char=':' -- |
1272 |
charoff NUTOKEN 50 -- % offset for alignment char --" |
1273 |
> |
1274 |
|
1275 |
<!-- Inheritance order for ALIGN, VALIGN and LANG properties: |
1276 |
ALIGN (TH|TD) < COL < TR < (THEAD|TBODY) |
1277 |
VALIGN (TH|TD) < TR < (THEAD|TBODY) < COL |
1278 |
LANG (TH|TD) < TR < (THEAD|TBODY) < COL < TABLE |
1279 |
--> |
1280 |
|
1281 |
<!ELEMENT table - - (caption?, col*, thead?, tfoot?, tbody+)> |
1282 |
<!ELEMENT caption - - (%text;)+> |
1283 |
<!ELEMENT thead - O (tr+)> |
1284 |
<!ELEMENT tfoot - O (tr+)> |
1285 |
<!ELEMENT tbody O O (tr+)> |
1286 |
<!ELEMENT col - O EMPTY> |
1287 |
<!ELEMENT tr - O (th|td)+> |
1288 |
<!ELEMENT (th|td) - O %body.content> |
1289 |
|
1290 |
<!-- NAME is used for rules to avoid SGML name clash with %Frame --> |
1291 |
|
1292 |
<!ATTLIST table -- table element -- |
1293 |
%attrs; -- id, lang, class -- |
1294 |
float (left|right) #IMPLIED -- relative to window -- |
1295 |
width CDATA #IMPLIED -- table width relative to window -- |
1296 |
cols NUMBER #IMPLIED -- used for immediate display mode -- |
1297 |
border CDATA #IMPLIED -- controls frame width around table -- |
1298 |
frame %Frame; #IMPLIED -- which parts of table frame to include -- |
1299 |
rules NAME #IMPLIED -- %Rules; controls rules between cells -- |
1300 |
cellspacing NUMBER #IMPLIED -- spacing between cells -- |
1301 |
cellpadding NUMBER #IMPLIED -- spacing within cells -- |
1302 |
> |
1303 |
|
1304 |
<!-- ALIGN is used here for compatibility with deployed browsers --> |
1305 |
<!ENTITY % Caption "(top|bottom|left|right)"> |
1306 |
|
1307 |
<!ATTLIST caption -- table caption -- |
1308 |
%attrs; -- id, lang, class -- |
1309 |
align %Caption; #IMPLIED -- relative to table -- |
1310 |
> |
1311 |
|
1312 |
<!-- |
1313 |
COL elements define groups of columns and the alignment |
1314 |
properties of their cells. The WIDTH attribute specifies the |
1315 |
width of the columns, e.g. |
1316 |
|
1317 |
|
1318 |
Dave Raggett Page 22 |
1319 |
|
1320 |
|
1321 |
|
1322 |
HTML Tables 03 Oct 95 |
1323 |
|
1324 |
width=64 width in "pixels", see earlier note on units |
1325 |
width=0.5* relative width of 0.5 (default is 1.0) |
1326 |
|
1327 |
Percentage widths are inappropriate as you would need to check that |
1328 |
the numbers add up, and they would all have to be changed if a column |
1329 |
was inserted or removed. The "*" suffix is used to simplify importing |
1330 |
tables from the CALS representation. |
1331 |
--> |
1332 |
|
1333 |
<!ATTLIST col -- column groups and properties -- |
1334 |
%attrs; -- id, lang, class -- |
1335 |
span NUMBER 1 -- number of columns spanned by group -- |
1336 |
width CDATA #IMPLIED -- relative width e.g. 2.5 -- |
1337 |
%cell.halign; -- horizontal alignment in cells -- |
1338 |
%cell.valign; -- vertical alignment in cells -- |
1339 |
> |
1340 |
|
1341 |
<!-- |
1342 |
Use THEAD to duplicate headers when breaking table |
1343 |
across page boundaries, or for static headers when |
1344 |
body sections are rendered in scrolling panel. |
1345 |
|
1346 |
Use TFOOT to duplicate footers when breaking table |
1347 |
across page boundaries, or for static footers when |
1348 |
body sections are rendered in scrolling panel. |
1349 |
|
1350 |
Use multiple TBODY sections when rules are needed |
1351 |
between groups of table rows. |
1352 |
--> |
1353 |
<!ATTLIST (thead|tbody|tfoot) -- table section -- |
1354 |
%attrs; -- id, lang, class -- |
1355 |
%cell.halign; -- horizontal alignment in cells -- |
1356 |
%cell.valign; -- vertical alignment in cells -- |
1357 |
> |
1358 |
|
1359 |
<!ATTLIST tr -- table row -- |
1360 |
%attrs; -- id, lang, class -- |
1361 |
%cell.halign; -- horizontal alignment in cells -- |
1362 |
%cell.valign; -- vertical alignment in cells -- |
1363 |
> |
1364 |
|
1365 |
<!ATTLIST (th|td) -- header or data cell -- |
1366 |
%attrs; -- id, lang, class -- |
1367 |
axis CDATA #IMPLIED -- defaults to cell content -- |
1368 |
axes CDATA #IMPLIED -- list of axis names -- |
1369 |
nowrap (nowrap) #IMPLIED -- suppress word wrap -- |
1370 |
rowspan NUMBER 1 -- number of rows spanned by cell -- |
1371 |
colspan NUMBER 1 -- number of cols spanned by cell -- |
1372 |
%cell.halign; -- horizontal alignment in cells -- |
1373 |
%cell.valign; -- vertical alignment in cells -- |
1374 |
> |
1375 |
|
1376 |
------------------------------------------------------------------------------ |
1377 |
|
1378 |
Dave Raggett Page 23 |
1379 |
|
1380 |
|
1381 |
|
1382 |
HTML Tables 03 Oct 95 |
1383 |
|
1384 |
References |
1385 |
|
1386 |
Arena |
1387 |
W3C's HTML3 browser, see "http://www.w3.org/pub/WWW/Arena/". |
1388 |
Arena was originally created as a proof of concept demo for |
1389 |
ideas in the HTML+ specification that preceded HTML3. The |
1390 |
browser is now being re-implemented to provide a reference |
1391 |
implementation of HTML3 along with support for style sheets and |
1392 |
client-side scripting. |
1393 |
|
1394 |
CALS |
1395 |
Continuous Acquisition and Life-Cycle Support (formerly |
1396 |
Computer-aided Acquisition and Logistics Support) (CALS) is a |
1397 |
Department of Defense (DoD) strategy for achieving effective |
1398 |
creation, exchange, and use of digital data for weapon systems |
1399 |
and equipment. More information can be found from the US Navy |
1400 |
CALS home page at http://navysgml.dt.navy.mil/cals.html |
1401 |
|
1402 |
|
1403 |
HTML 3.0 |
1404 |
HyperText Markup Language Specification Version 3.0. This is the |
1405 |
initial draft specification as published in March 1995. Work on |
1406 |
refining HTML3 is proceeding piecemeal with the new table |
1407 |
specification as one of the pieces. For W3C related work on |
1408 |
HTML, see "http://www.w3.org/pub/WWW/MarkUp/". |
1409 |
|
1410 |
RFC 1766 |
1411 |
"Tags for the Identification of Languages", by H. Alvestrand, |
1412 |
UNINETT, March 1995. This document can be downloaded from |
1413 |
"ftp://ds.internic.net/rfc/rfc1766.txt". |
1414 |
|
1415 |
------------------------------------------------------------------------------ |
1416 |
|
1417 |
|
1418 |
|
1419 |
|
1420 |
|
1421 |
|
1422 |
|
1423 |
|
1424 |
|
1425 |
|
1426 |
|
1427 |
|
1428 |
|
1429 |
|
1430 |
|
1431 |
|
1432 |
|
1433 |
|
1434 |
|
1435 |
|
1436 |
|
1437 |
|
1438 |
Dave Raggett Page 24 |
1439 |
|