Skip to content

Commit 0e15ec2

Browse files
committed
[css2] For all tables, width: auto implies table-layout: auto, better description of max column widths, expression multiple pass removed, computed value inherited, some editorial comments removed
--HG-- extra : convert_revision : svn%3A73dc7c4b-06e6-40f3-b4f7-9ed1dbc14bfc/trunk%401528
1 parent d335130 commit 0e15ec2

1 file changed

Lines changed: 53 additions & 63 deletions

File tree

css2/tables.src

Lines changed: 53 additions & 63 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.33 1998-04-22 23:04:24 ijacobs Exp $ -->
3+
<!-- $Id: tables.src,v 2.34 1998-04-23 23:15:49 ijacobs Exp $ -->
44
<head>
55
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
66
<title>Tables</title>
@@ -741,17 +741,11 @@ and columns. Values have the following meaning:</p>
741741
not depend on the contents of the cells; it only depends on the
742742
table's width and the width of the columns.
743743

744-
<!-- This doesn't account for inline tables -IJ
745-
<P>The table's width is determined by the <span
746-
class="propinst-width">'width'</span> property. If the value is
747-
'auto', the table is as wide as the available horizontal space.
748-
-->
749-
750744
<P>The table's width may be specified explicitly with the <span
751-
class="propinst-width">'width'</span> property. Otherwise, for block
752-
tables, 'width: auto' means that the table is as wide as the
753-
containing block. For inline tables, 'width: auto' means use the <a
754-
href="#auto-table-layout">automatic table layout</a> algorithm.
745+
class="propinst-width">'width'</span> property. A value of 'auto' (for
746+
both 'display: table' and 'display: inline-table') means use the <a
747+
href="#auto-table-layout">automatic table layout</a> algorithm (i.e.,
748+
it implies 'table-layout: auto').
755749

756750
<P>The width of each column is determined as follows:</p>
757751

@@ -783,81 +777,77 @@ dimension.
783777
<p>It is possible that the sum of the widths of the columns exceeds
784778
the value of the table's <span class="propinst-width">'width'</span>
785779
property. In that case the larger width is used as the <a
786-
href="cascade.html#actual-value">actual value</a> of the table's
780+
href="cascade.html#computed-value">computed value</a> of the table's
787781
<span class="propinst-width">'width'</span> property.
788782

789783

790784
<h4><a name="auto-table-layout">Automatic table layout</a></h4>
791785

792-
<P>This is a multiple-pass algorithm in which a table width is given
793-
by the width of its columns (and intervening <a
794-
href="#borders">borders</a>). This algorithm reflects the behavior of
795-
several popular HTML user agents at the writing of this
796-
specification. UAs are not required to implement this algorithm to
797-
determine the table layout in the case that <span
786+
<P>In this algorithm (which generally requires no more than two
787+
passes), the table's width is given by the width of its columns (and
788+
intervening <a href="#borders">borders</a>). This algorithm reflects
789+
the behavior of several popular HTML user agents at the writing of
790+
this specification. UAs are not required to implement this algorithm
791+
to determine the table layout in the case that <span
798792
class="propinst-table-layout">'table-layout'</span> is 'auto'; they
799793
can use any other algorithm.
800794

801-
<P>In this algorithm, the width of each column is based on the largest
802-
unbreakable element in a cell in that column. This algorithm may be
803-
inefficient since it may demand multiple passes and requires the user
804-
agent to have access to all the content in the table before
805-
determining the final layout.
795+
<P>This algorithm may be inefficient since it requires the user agent to
796+
have access to all the content in the table before determining the
797+
final layout and may may demand more than one pass.
806798

807-
<!-- Explain why max widths are calculated: max width is that
808-
which avoids wrap of inline content (DSR definition) -IJ -->
809-
810-
<p>In this algorithm, column widths are determined as follows:</p>
799+
<p>Column widths are determined as follows:</p>
811800

812801
<ol>
813-
<li>For each cell, determine the minimum and maximum widths required.
814-
Cells with a specified <span class="propinst-width">'width'</span> get
815-
a minimum width equal to the greater of the specified width and the
816-
minimum required width.
817-
818-
<li>For each column, determine a maximum and minimum width from the
819-
cells that span one column. If the column has a value of <span
820-
class="propinst-width">'width'</span> greater than the minimum over
821-
the cells, then the former is used as the minimum width for the
822-
column.
802+
<li>Calculate the normal width of each cell (either the
803+
width specified by the <span class="propinst-width">'width'</span>
804+
property, or, for the value 'auto', the content width. Also,
805+
calculate the "maximum" width of each cell. The maximum width is
806+
the minimum width required to format the inline contents of the cell
807+
as a single line.
808+
809+
<li>For each column, determine a maximum and minimum column width from
810+
the cells that span only that column. The minimum is that required by
811+
the widest unbreakable cell. The maximum is that of the cell with the
812+
largest maximum width.
813+
814+
<P>If the computed value of the <span
815+
class="propinst-width">'width'</span> property for a cell in the
816+
column is less than the minimum column width, it is set to the minimum
817+
column width.
823818

824819
<li>For each cell that spans more than one column, increase the
825820
minimum and maximum widths of the columns it spans enough so the
826821
combined minimum and maximum widths are at least those of the cell. If
827822
possible, widen all spanned columns by approximately the same amount.
828823
</ol>
829824

830-
<p>Now we have a maximum and minimum width per column. We now
825+
<p>This gives a maximum and minimum width for each column. We now
831826
determine final column widths. Cell spacing is appropriately added
832-
into these calculations.
827+
into these calculations.
833828

834829
<P>Column widths influence the final table width as follows:</p>
835830

836831
<P>If the table element's <span class="propinst-width">'width'</span>
837-
property has a specified value V other than 'auto', the property's
838-
actual value is the greater of V and the minimum width required by
839-
the columns. If V is greater than the minimum width required,
840-
the extra width should be distributed over the columns.
841-
842-
<p>If a block table element's <span
843-
class="propinst-width">'width'</span> property has the value 'auto',
844-
the actual table width is determined as in the previous paragraph,
845-
substituting the containing block width for the table element's
846-
specified <span class="propinst-width">'width'</span> value. However,
847-
if the maximum width required for the columns is less than the width
848-
of the table's containing block, use the maximum width.
849-
850-
<P>If an inline table element's <span
851-
class="propinst-width">'width'</span> property has the value 'auto',
852-
the actual table width is the minimum width required by the columns.
853-
854-
<p>A percentage is relative to the table width. If the table's width
855-
is 'auto', a percentage represents a constraint on the column's width,
856-
which a UA should try to satisfy. (Obviously, this is not always
857-
possible: if the column's width is '110%', the constraint cannot be
858-
satisfied.)</p>
859-
860-
<!-- How do percentage values work for inline tables, width: auto? -IJ -->
832+
property has a specified value W other than 'auto', the property's
833+
computed value is the greater of W and the minimum width MIN required
834+
by the columns. If W is greater than MIN, the extra width should be
835+
distributed over the columns.
836+
837+
<p>If an element with 'display: table' has 'width: auto', the computed
838+
table width is the greater of the table's containing block width and
839+
MIN. However, if the maximum width MAX required by the columns is
840+
less than that of the containing block, use MAX.
841+
842+
<P>If an element with 'display: inline-table' has 'width: auto', the
843+
computed table width is MIN.
844+
845+
<p>A percentage value for a column width is relative to the table
846+
width. If the table has 'width: auto', a percentage represents a
847+
constraint on the column's width, which a UA should try to
848+
satisfy. (Obviously, this is not always possible: if the column's
849+
width is '110%', the constraint cannot be satisfied.)</p>
850+
861851

862852
<div class="note">
863853
<P> <em><strong>Note.</strong> In this algorithm, rows (and row

0 commit comments

Comments
 (0)