11<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
22<html lang="en">
3- <!-- $Id: tables.src,v 2.3 1998-02-10 00:53:42 ijacobs Exp $ -->
3+ <!-- $Id: tables.src,v 2.4 1998-02-11 21:47:44 bbos Exp $ -->
44<head>
55<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
66<title>Tables</title>
@@ -37,11 +37,11 @@ table described in HTML 4.0:
3737<TABLE>
3838<CAPTION>This is a simple 3x3 table</CAPTION>
3939<TR id="row1">
40- <TH>Header 1 <TH >Header 2 <TH >Header 3
40+ <TH>Header 1 <TD >Cell 1 <TD >Cell 2
4141<TR id="row2">
42- <TD >Cell 1 <TD>Cell 2 <TD>Cell 3
42+ <TH >Header 2 <TD>Cell 3 <TD>Cell 4
4343<TR id="row3">
44- <TD >Cell 4 <TD>Cell 5 <TD>Cell 6
44+ <TH >Header 3 <TD>Cell 5 <TD>Cell 6
4545</TABLE>
4646</PRE>
4747
@@ -58,18 +58,17 @@ in the header cells and present the data with a bold font weight:</P>
5858 TH { text-align: center; font-weight: bold }
5959</PRE>
6060
61- <P>The next rules align the text of the three header cells
62- along a common baseline and centers the text in each data cell:</p>
63-
61+ <P>The next rules align the text of the header cells on their baseline
62+ and vertically centers the text in each data cell:</p>
6463
6564<PRE>
6665 TH { vertical-align: baseline }
6766 TD { vertical-align: center }
6867</PRE>
6968
70- <P>The next rules specify that the row of header cells will be surrounded
71- by a 3px solid blue border and each row of data cells will be surrounded
72- by a 1px solid black border:</P>
69+ <P>The next rules specify that the top row will be surrounded by a 3px
70+ solid blue border and each of the other rows will be surrounded by a
71+ 1px solid black border:</P>
7372
7473<PRE>
7574 TABLE { cell-spacing: none }
@@ -83,29 +82,27 @@ rows meet. What color (black or blue) and thickness (1px or 3px) will
8382the border between row1 and row2 be? We discuss this in the section on
8483<a href="#border-conflict-resolution">border conflict resolution.</a>
8584
86- <P>The following rule positions the table caption centered, above
87- the table:</P>
85+ <P>The following rule puts the table caption above the table:</P>
8886
8987<PRE>
9088 CAPTION { caption-side: top }
9189</PRE>
9290
93- <P>Finally, the following rule specifies that, when rendered
94- aurally, each column of data is to be spoken
95- as a "Header, Data, Data":</P>
91+ <P>Finally, the following rule specifies that, when rendered aurally,
92+ each row of data is to be spoken as a "Header, Data, Data":</P>
9693
9794<PRE>
9895 TH { speak-header: once }
9996</PRE>
10097
101- <P>For instance, the first column would be spoken "Header1 Cell1 Cell4 ".
102- The following rule:</p>
98+ <P>For instance, the first row would be spoken "Header1 Cell1 Cell2 ".
99+ On the other hand, with the following rule:</p>
103100
104101<PRE>
105102 TH { speak-header: always }
106103</PRE>
107104
108- <P>would be spoken "Header1 Cell1 Header1 Cell4 ".
105+ <P>it would be spoken "Header1 Cell1 Header1 Cell2 ".
109106</div>
110107
111108<P>The preceding example shows how CSS works with HTML 4.0 elements;
@@ -171,9 +168,9 @@ in an <a href="visuren.html#inline-formatting">inline formatting
171168context</a>).
172169
173170<dt><strong>table-row</strong> (In HTML: TR)
174- <dd>Specifies that an element refers to a row of cells.
175- Note, however, that the calculation of <em>which</em> row of
176- cells depends on the document language.
171+ <dd>Specifies that an element is a row of cells.
172+ <!-- Note, however, that the calculation of <em>which</em> row of
173+ cells depends on the document language.-->
177174
178175<dt><strong>table-row-group</strong> (In HTML: TBODY)
179176<dd>Specifies that an element groups one or more rows.
@@ -191,24 +188,26 @@ after all other rows and rowgroups and before any bottom
191188captions.
192189
193190<dt><strong>table-column</strong> (In HTML: COL)
194- <dd>Specifies that an element refers to a column
195- of cells. Note, however, that the calculation of <em>which</em> column
196- of cells depends on the document language.
191+ <dd>Specifies that an element describes a column
192+ of cells. <!-- Note, however, that the calculation of <em>which</em> column
193+ of cells depends on the document language.-->
197194
198195<dt><strong>table-column-group</strong> (In HTML: COLGROUP)
199196<dd>Specifies that an element groups one or more columns.
200197
201198<dt><strong>table-cell</strong> (In HTML: TD, TH)
202- <dd>Specifies that an element contains table cell
203- data. 'Table-cell' elements may only be inside of
204- 'table-row' elements.
199+ <dd>Specifies that an element represents a table cell.
205200
206201<dt><strong>table-caption</strong> (In HTML: CAPTION)
207- <dd>Specifies a caption for the table. Inherited
208- values of properties set for a caption element come
209- from the parent table element (e.g., percentage widths).
202+ <dd>Specifies a caption for the table.
210203</dl>
211204
205+ <p>Elements with <span class="propinst-display">'display'</span> set
206+ to 'table-column' or 'table-column-group' are not rendered (exactly as
207+ if they had 'display: none'), but they are useful, because they may
208+ have attributes which induce a certain style for the columns they
209+ represent.</p>
210+
212211<p>The <a href="sample.html">default style sheet for HTML 4.0</a>
213212in the appendix illustrates the use of these values for HTML 4.0:</p>
214213
@@ -243,18 +242,23 @@ to the following rules:</p>
243242<li>Any table element will automatically generate a whole table tree
244243around itself, consisting of at least a 'table'/'inline-table', a
245244'table-row', and a 'table-cell'.
246- <li>If the parent a 'table-cell' is not a 'table-row',
245+ <li>If the parent of a 'table-cell' is not a 'table-row',
247246an anonymous 'table-row' element will be assumed as its parent, and
248247this anonymous element will span all consecutive 'table-cell'
249248siblings.
250249<li>If the parent of a 'table-row' is not a
251250'table'/'inline-table' nor a row group element, an anonymous 'table'
252251will be assumed as its parent, spanning all consecutive siblings that
253252also need an anonymous 'table' parent.
253+ <li>If the parent of a row group element is not a
254+ 'table'/'inline-table', an anonymous 'table' will be assumed as its
255+ parent, spanning all consecutive siblings that also need an anonymous
256+ 'table' parent.
257+ <li>Anonymous 'table-cell' elements are inserted as children of
258+ 'table-rows', to contain consecutive children that are not
259+ 'table-cell' elements.
254260</ol>
255261
256- <P>The same holds for row group elements.
257-
258262<div class="example">
259263<p>In this XML example, an anonymous 'table' is inserted to
260264contain the HBOX element:</p>
@@ -275,10 +279,6 @@ VBOX {display: table-cell}
275279</pre>
276280</div><!-- end of example -->
277281
278- <p>Anonymous 'table-cell' elements are inserted as children of
279- 'table-rows', to contain consecutive children that are not
280- 'table-cell' elements.</p>
281-
282282<div class="example">
283283<p>In this example, three anonymous 'table-cell' elements are inserted
284284to contain the text in the ROWs. Note that the text is further
@@ -303,12 +303,6 @@ D {display: inline; font-weight: bolder}
303303
304304</div><!-- end of example -->
305305
306- <p>Elements with <span class="propinst-display">'display'</span> set
307- to 'table-column' or 'table-column-group' are not rendered (exactly as
308- if they had 'display: none'), but they are useful, because they may
309- have attributes which induce a certain style for the columns they
310- represent.</p>
311-
312306<h2>Table selectors</h2>
313307
314308<p>Due to the uniqueness of the table structure, there are several
@@ -364,7 +358,7 @@ for a cell in a particular row and column authors may use
364358an "id" selector, as in:</p>
365359
366360<pre class="example">
367- TD. one-cell { color: green } /* HTML row and data cell */
361+ TD# one-cell { color: green } /* HTML row and data cell */
368362</pre>
369363
370364<!-- I added row to this note. -IJ -->
@@ -388,16 +382,16 @@ access to rules.]</p>
388382<dt><strong>:row[n], :row[%n], :row[%n+m]</strong>
389383<dd>This pseudo-class allows
390384the author to specify "the third row" (":row[3]"), "every third row"
391- (":row[%3]"), or "every third row, starting with the second row"
392- (":row[%3 + 1") (rows are zero-indexed) .
385+ (":row[%3]"), or "every third row, starting with the first row"
386+ (":row[%3 + 1").
393387
394388<dt><strong>:row-even</strong>
395389<dd>This is a shortcut for a pseudo-class of
396390":row[%2]".
397391
398392<dt><strong>:row-odd</strong>
399393<dd>This is a shortcut for a pseudo-class of
400- ":row[%2+1.
394+ ":row[%2+1] .
401395</dl>
402396
403397<!-- Need example -IJ -->
@@ -411,8 +405,7 @@ the author to specify "the third row" (":row[3]"), "every third row"
411405<dd>This pseudo-class
412406allows the author to specify (for example) "the third column"
413407(":column[3]"), "every third column" (":column[%3]"), or "every third
414- column, starting with the second column" (":column[%3 + 1") (columns
415- are zero-indexed).
408+ column, starting with the first column" (":column[%3 + 1").
416409
417410<dt><strong>:column-even</strong>
418411<dd>This is a shortcut for a pseudo-class of
@@ -474,6 +467,8 @@ property places captions below tables.
474467The caption will be as wide as the table,
475468and caption text will be left-justified horizontally
476469and centered vertically.
470+ (But that last property has no effect if the caption is at the top or
471+ bottom.)
477472
478473<PRE>
479474 CAPTION { caption-side: bottom;
@@ -491,9 +486,9 @@ href="conform.html#doclanguage">document language</a>, table elements
491486generate rectangular <a href="visuren.html#box-dimensions">boxes</a>
492487with content, padding, border, and margin areas.
493488
494- <p>The visual layout of these boxes is governed by a rectangular grid
495- of rows and columns. Each box occupies a whole number of grid cells,
496- determined according to the following rules:</p>
489+ <p>The visual layout of these boxes is governed by a rectangular,
490+ irregular grid of rows and columns. Each box occupies a whole number
491+ of grid cells, determined according to the following rules:</p>
497492
498493<ol>
499494<li>Each row box occupies one row of grid cells. Together, the row
@@ -505,12 +500,14 @@ many grid rows as there are row elements).
505500
506501<li>Columns are placed next to each other in the order they occur. Each
507502one occupies the number of grid columns given by its <span
508- class="propinst-column-span">'column-span'</span> property. A column
509- group occupies the same columns as the columns it contains. The
503+ class="propinst-column-span">'column-span'</span> property. The
510504first column may be either on the left or on the right, depending on
511505the value of the <span class="propinst-direction">'direction'</span>
512506property of the table.
513507
508+ <li>A column group occupies the same grid cells as the columns it
509+ contains. <em class=note>[Not true, need correct description.]</em>
510+
514511<li>Structurally speaking, each cell belongs to one row and column;
515512this row and column determine the coordinates of the cell.
516513Visually, each cell occupies a
@@ -544,7 +541,27 @@ i.e., to easily design evenly spaced table cells in a table.</p>
544541<p><em>[Can this work? Maybe it is better to say that table elements
545542(other than 'table' and 'inline-table') have no margins at all, and
546543instead use a single 'cell-spacing' property for the whole table, or a
547- single horizontal and a single vertical spacing (see below)]</em></p>
544+ single horizontal and a single vertical spacing (see
545+ below). Example:</em></p>
546+
547+ <pre>
548+ <TABLE>
549+ &tl;TR><TD id=t1> <TD id=t2>
550+ &tl;TR><TD id=t3> <TD id=t4>
551+ </TABLE>
552+ </pre>
553+
554+ <p><em>If the style sheet says:</em>
555+
556+ <pre>
557+ #t1 {margin: 1cm}
558+ #t2 {margin: 2cm}
559+ #t3 {margin: 3cm}
560+ #t4 {margin: 4cm}
561+ </pre>
562+
563+ <p><em>the left column will be (1 + 3 + 3 =) 7cm high, and the right
564+ one (2 + 4 + 4 =) 10cm. Where do the extra 3cm go?</em>]
548565
549566<p>Only four properties apply to column and column group elements:
550567<span class="propinst-border">'border'</span>, <span
@@ -586,11 +603,10 @@ layers for purposes of visual precedence. Except for transparent
586603parts, each layer hides lower layers from view, as shown in
587604Figure 1.</p>
588605
589- <!-- Are you sure you want to use OBJECT? -IJ -->
590- <object data="images/tbl-layers.gif">
591- <P>Figure 1. Schema of table layers.
606+ <div>
592607<p><img src="images/tbl-layers.gif" alt="schema of table layers"></p>
593- </object>
608+ <P>Figure 1. Schema of table layers.
609+ </div>
594610
595611<ol>
596612<li>
@@ -625,11 +641,11 @@ These "empty" cells are transparent, letting lower layers shine through.
625641</li>
626642</ol>
627643
628- <div class="html-example"><P>
629- In the following example, the rows contain four cells, but the first
630- cell of the second row has no content (it is "empty") , and thus
631- the table background shines through. The following HTML code
632- and style sheet rules: </p>
644+ <div class="html-example">
645+ <P> In the following example, the first row contains four cells, but
646+ the second row contains no cells , and thus the table background shines
647+ through, except where a cell from the first row spans into this
648+ row. The following HTML code and style sheet rules</p>
633649
634650<PRE>
635651<HTML>
@@ -649,15 +665,13 @@ and style sheet rules:</p>
649665 <TD> 4
650666 </TR>
651667 <TR>
652- <TD>
653- <TD colspan="2"> 5
654668 </TR>
655669</TABLE>
656670</BODY>
657671</HTML>
658672</PRE>
659673
660- <P>Might be rendered as follows:</p>
674+ <P>might be rendered as follows:</p>
661675
662676<p><img src="images/tbl-empty.gif" alt="Table with an empty cell in lower left corner"></p>
663677</div>
@@ -693,7 +707,7 @@ and columns. Values have the following meaning:</p>
693707
694708<P>With this (fast) algorithm in which the
695709horizontal layout of the table does not depend on the
696- contents of every cell; it only depends on the table's width, the width
710+ contents of every cell; it only depends on the table's width and the width
697711of the cells in the first row.
698712
699713<P>The table's width is determined by the <span
0 commit comments