Skip to content

Commit 1cba172

Browse files
committed
[css2] Added border-collapse, fixed examples, column/row rules do not apply to HTML,
--HG-- extra : convert_revision : svn%3A73dc7c4b-06e6-40f3-b4f7-9ed1dbc14bfc/trunk%401238
1 parent c62694f commit 1cba172

1 file changed

Lines changed: 49 additions & 59 deletions

File tree

css2/tables.src

Lines changed: 49 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
22
<html lang="en">
3-
<!-- $Id: tables.src,v 2.19 1998-03-16 14:35:28 ijacobs Exp $ -->
3+
<!-- $Id: tables.src,v 2.20 1998-03-17 01:18:29 ijacobs Exp $ -->
44
<head>
55
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
66
<title>Tables</title>
@@ -264,17 +264,14 @@ CAPTION { display: table-caption }
264264
class="propinst-display">'display'</span> property values for HTML
265265
documents, since authors should not alter an element's expected
266266
behavior.
267-
<!-- must ==> may 27/2/98 -->
268267

269268
<h3><a name="anonymous-boxes">Anonymous table boxes</a></h3>
270269

271-
<P>For
272-
document languages other than HTML, authors may end up some, but not
273-
all, document language elements that correspond to those in the CSS2
274-
table model. In these cases, the "missing" elements must be assumed in
275-
order for the table model to work. The missing elements generate <a
276-
href="visuren.html#anonymous">anonymous</a> boxes according to the
277-
following rules:</p>
270+
<P>Document languages other than HTML may not contain all the elements
271+
in the CSS2 table model. In these cases, the "missing" elements must
272+
be assumed in order for the table model to work. The missing elements
273+
generate <a href="visuren.html#anonymous">anonymous</a> boxes
274+
according to the following rules:</p>
278275

279276
<ol>
280277

@@ -363,8 +360,8 @@ setting properties on columns.
363360
<dt><span class="propinst-border">'border'</span>
364361

365362
<dd>The various border properties apply to columns only if <span
366-
class="propinst-border-spacing">'border-spacing'</span> is set to
367-
'none' on the table element. In that case, borders set on columns and
363+
class="propinst-border-collapse">'border-collapse'</span> is set to
364+
'collapse' on the table element. In that case, borders set on columns and
368365
column groups are input to the <a
369366
href="#border-conflict-resolution">conflict resolution algorithm</a>
370367
that selects the border styles at every cell edge.
@@ -441,7 +438,6 @@ table with a caption above it; the bottom margin of the caption is
441438
collapsed with the top margin of the table.
442439
</div>
443440

444-
445441
<h3>Caption position and alignment</h3>
446442

447443
<!-- #include src=properties/caption-side.srb -->
@@ -538,7 +534,6 @@ href="conform.html#doclanguage">document language</a>, table elements
538534
generate rectangular <a href="visuren.html#box-dimensions">boxes</a>
539535
with content, padding, border, and margin areas.
540536

541-
542537
<h3><a name="spanning-props">Row and column spans:</a> <span
543538
class="propinst-column-span">'column-span'</span>, and
544539
<span class="propinst-row-span">'row-span'</span></h3>
@@ -559,7 +554,10 @@ columns spanned by a cell, column, or column group.</p>
559554

560555
<p>The visual layout of these boxes is governed by a rectangular,
561556
irregular grid of rows and columns. Each box occupies a whole number
562-
of grid cells, determined according to the following rules:</p>
557+
of grid cells, determined according to the following rules.
558+
These rules do not apply to HTML 4.0 or earlier HTML versions;
559+
HTML imposes its own limitations on row and column spans.
560+
</p>
563561

564562
<ol>
565563
<li>Each row box occupies one row of grid cells. Together, the row
@@ -577,7 +575,9 @@ the value of the <span class="propinst-direction">'direction'</span>
577575
property of the table.
578576

579577
<li>A column group occupies the same grid cells as the columns it
580-
contains. <em class=note>[Not true, need correct description.]</em>
578+
contains.
579+
580+
<P><em class=note>[Not true, need correct description.]</em>
581581

582582
<li>Structurally speaking, each cell belongs to one row and column;
583583
this row and column determine the coordinates of the cell.
@@ -598,19 +598,6 @@ only if there are enough rows: a cell cannot extend below the last row
598598
box; it is made shorter until it fits.
599599
</ol>
600600

601-
<div class="note">
602-
<p><em><strong>Note.</strong> The above is an extension of the HTML 4.0
603-
algorithm. The HTML 4.0 specification only defines the position of
604-
cells if they can be placed so that they do not leave gaps. If cells
605-
would leave gaps when following the algorithm above (or, equivalently,
606-
would overlap other cells according to the algorithm in the HTML 4.0
607-
specification), the table is in error according to HTML 4.0, and a UA
608-
is free to try to recover. UAs that implement CSS2 are not free
609-
anymore, and must leave gaps, as per the algorithm above. </em></div>
610-
611-
<!-- Make the above only suggested for XML, not for HTML. HTML stays
612-
undefined. 27/2/98 -->
613-
614601
<div class="html-example">
615602
<p>Here is an example:
616603

@@ -688,7 +675,7 @@ row. The following HTML code and style rules</p>
688675
&lt;HTML&gt;
689676
&lt;HEAD&gt;
690677
&lt;STYLE type="text/css"&gt;
691-
TABLE { background: #ff0; border-spacing: none }
678+
TABLE { background: #ff0; border-collapse: collapse }
692679
TD { background: red; border: double black }
693680
&lt;/STYLE&gt;
694681
&lt;/HEAD&gt;
@@ -750,25 +737,23 @@ and columns. Values have the following meaning:</p>
750737

751738
<P>With this (fast) algorithm, the horizontal layout of the table does
752739
not depend on the contents of the cells; it only depends on the
753-
table's width and the width of the cells in the first row.
754-
755-
<!-- Only use width of column, not of cells. ChrisW. Agreed. 27/2/98 -->
740+
table's width and the width of the columns.
756741

757742
<P>The table's width is determined by the <span
758743
class="propinst-width">'width'</span> property. If the value is
759744
'auto', the table is as wide as the available horizontal space.
760745

761-
<P>The width of each column is determined as follows:
746+
<P>The width of each column is determined as follows:</p>
762747

763748
<ol>
764-
<li>A cell in the first row with a value other than 'auto' for the
749+
<li>A column element with a value other than 'auto' for the
765750
<span class="propinst-width">'width'</span> property sets the width
766-
for that column. If the cell spans columns, the width is divided over
767-
the columns.
751+
for that columns.
768752

769-
<li>If a cell in the first row has 'width' 'auto', but there is a
770-
column element for that column with 'width' other than 'auto', than
771-
that width is used.
753+
<li>Otherwise, a cell in the first row with a value other than 'auto'
754+
for the <span class="propinst-width">'width'</span> property sets the
755+
width for that column. If the cell spans columns, the width is divided
756+
over the columns.
772757

773758
<li>Any remaining columns equally divide the remaining space.
774759
</ol>
@@ -862,6 +847,14 @@ vice versa.</em>
862847
<P>Cells may be aligned vertically (within a row) and
863848
horizontally (within a column).
864849

850+
<div class="note"><P>
851+
<em><strong>Note.</strong>
852+
Table cells may be relatively and absolutely positioned, but
853+
this is not recommended: positioning and floating remove a box
854+
from the flow, affecting table alignment.
855+
</em>
856+
</div>
857+
865858
<h4><a name="vertical-align">Vertical alignment in a row</a></h4>
866859

867860
<P>The height of a cell's box is constrained by the rows that contain
@@ -1036,18 +1029,17 @@ other is suitable for borders that are continuous from one end of the
10361029
table to the other. Many border styles can be achieved with either
10371030
model, so it is often a matter of taste which one is used.
10381031

1039-
<!-- #include src=properties/border-spacing.srb -->
1032+
<!-- #include src=properties/border-collapse.srb -->
1033+
1034+
<P>This property selects a table's border model. The value 'separate'
1035+
selects the separated borders border model. The value 'collapse'
1036+
selects the collapsing borders model. The models are described below.
10401037

1041-
<!-- make collapse/non-collapse a separate, binary property.
1042-
border-collapse: collapse|separate. 27/2/98 -->
1038+
<h3><a name="2D">The separated borders model</a></h3>
10431039

1044-
<P>The property <span
1045-
class="propinst-border-spacing">'border-spacing'</span> selects a
1046-
table's border model. Values have the following meanings:</p>
1040+
<!-- #include src=properties/border-spacing.srb -->
10471041

10481042
<dl>
1049-
<dt><strong>none</strong>
1050-
<dd>Use the collapsing border model.
10511043
<dt><span class="index-inst" title="&lt;length&gt;"><span
10521044
class="value-inst-length"><strong>&lt;length&gt;</strong></span></span>
10531045
<span class="index-inst" title="&lt;length&gt;"><span
@@ -1060,10 +1052,6 @@ spacing and the second the vertical spacing. Lengths may
10601052
not be negative.
10611053
</dl>
10621054

1063-
<P>The models are described below.
1064-
1065-
<h3><a name="2D">The separated borders model</a></h3>
1066-
10671055
<p>In this model, each cell has an individual border. The
10681056
<span class="propinst-border-spacing">'border-spacing'</span> property
10691057
specifies the distance between the borders of adjacent cells. This
@@ -1078,7 +1066,9 @@ those elements.
10781066
like this:
10791067

10801068
<pre>
1081-
TABLE { border: outset 10pt; border-spacing: 15pt }
1069+
TABLE { border: outset 10pt;
1070+
border-collapse: separate;
1071+
border-spacing: 15pt }
10821072
TD { border: inset 5pt }
10831073
TD.special { border: inset 10pt } /* The top-left cell */
10841074
</pre>
@@ -1093,15 +1083,15 @@ has a separate border as well.
10931083
</div>
10941084

10951085
<P>When this border model is used, the overall width of the table is
1096-
the sum of the cells plus the border-spacing between all borders. See
1086+
the sum of the cells plus the border spacing between all borders. See
10971087
the section on <a href="#auto-table-layout">automatic table layout</a>
10981088
for more information about table dimension calculations.
10991089

11001090
<h3><a name="collapsing-borders">The collapsing border model</a></h3>
11011091

11021092
<p>In the collapsing border model, it is possible to
11031093
specify borders that surround all or part of a cell, row, row group,
1104-
column, and column group. Borders for HTML's RULE attribute can be
1094+
column, and column group. Borders for HTML's "rule" attribute can be
11051095
specified this way.
11061096

11071097
<p>Borders are centered on the grid lines between the cells. User
@@ -1177,10 +1167,9 @@ group and, lastly, table.
11771167
<P>The following example illustrates the application
11781168
of these precedence rules. This style sheet:</p>
11791169

1180-
<!-- Add border-collapse: collapse to style below. 27/2/98 -->
1181-
11821170
<pre>
1183-
TABLE { border: 5px solid yellow; }
1171+
TABLE { border-collapse: collapse;
1172+
border: 5px solid yellow; }
11841173
*#col1 { border: 1px solid black; }
11851174
TD { border: 5px solid red; }
11861175
TD.solid-blue { border: 11px solid blue; }
@@ -1240,7 +1229,8 @@ attribute of HTML 4.0.
12401229

12411230
<pre>
12421231
TABLE[rules=rows] TR {border-top: solid}
1243-
TABLE[rules=rows] {border-spacing: none; border-top: hidden}
1232+
TABLE[rules=rows] {border-collapse: collapse;
1233+
border-top: hidden}
12441234
</pre>
12451235

12461236
<div class="figure">
@@ -1272,7 +1262,7 @@ two omitted internal borders.
12721262
<p>HTML source:</p>
12731263

12741264
<pre class="html-example">
1275-
&lt;TABLE style="border-spacing: none; border: solid;"&gt;
1265+
&lt;TABLE style="border-collapse: collapse; border: solid;"&gt;
12761266
&lt;TR&gt;&lt;TD style="border-right: hidden; border-bottom: hidden"&gt;foo&lt;/TD&gt;
12771267
&lt;TD style="border: solid"&gt;bar&lt;/TD&gt;&lt;/TR&gt;
12781268
&lt;TR&gt;&lt;TD style="border: none"&gt;foo&lt;/TD&gt;

0 commit comments

Comments
 (0)