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