. This example
   specifies a relative width of two and a half for column 3. The
   default relative width is 1.0. Note that the incremental mode may
   result in columns that are too small in some cases. The user agent
   can then choose to redraw the table with more appropriate column
   widths once all of the table data has been received. 
   Both the COL and the WIDTH attributes are required for the COLW
   element. The WIDTH attribute takes the form of a positive number and
   may include a decimal point for floating point values. The COL
   attribute is a positive integer value. COL=1 denotes the first
   column, with COL=2 for the second column and so on, where columns
   are numbered from left to right. Simple column ranges are also
   permitted, e.g. COL=3-7 which matches columns 3, 4, 5, 6 and 7. The
   range is limited to the form lower-upper, when both values are
   positive integer values separated by a hyphen, and upper should be
   greater than lower. 
   An example for an incremental mode table with 4 columns: 
   
Dave Raggett                                                            Page 8
HTML Tables                                                      7th July 1995
   You can also specify relative widths for the auto layout mode. The
   same goes for the table width attribute. The sizing algorithm does
   its best to meet your suggestions, but ensures that all the columns
   are large enough for the cell contents. Further details on the
   algorithm are given in a later section. 
Dave Raggett                                                            Page 9
HTML Tables                                                      7th July 1995
Horizontal Alignment of Cell Contents
   By default, data cells (TD) are left aligned while header cells (TH)
   are centered. You can override the default alignment with the ALIGN
   attribute on the table cell, e.g. | . There are
   several attributes assoociated with horizontal alignment: 
   ALIGN 
       This can be one of: LEFT, CENTER, RIGHT, JUSTIFY and CHAR. User
       agents may treat Justify as left alignment if they lack support
       for text justification. ALIGN=CHAR is used for aligning cell
       contents on a particular character. The attribute value for
       ALIGN is case insensitive. 
   CHAR 
       This is used to specify an alignment character for use with
       align=char, e.g. char=":". The default character is "." 
   CHAROFF 
       This is used with align=char to specify the relative offset of
       the alignment character with respect to the width of the cell.
       The attribute value takes the form of a positive integer in the
       range 1 to 100 followed by a percent sign, e.g. charoff="50%". 
   The earlier example of aligning form fields can be more simply
   achieved using align on char and using the CHAR attribute to set the
   alignment character to a convenient character, for example: 
   
   
   Each line in the table is then indented so that all the colons are
   positioned under one another. 
Vertical Alignment of Cell Contents
   By default, cell contents are vertically aligned at the middle of
   each cell. The VALIGN attribute can be used with TH or TD to
   override this default. It can take one of the following values: TOP,
   MIDDLE or BOTTOM, e.g.  | . Note that the attribute
   value is case insensitive. 
   Note: the ability to ensure several cells on the same row share the
   same baseline has been left out of this specification owing to
   difficulties in providing a adequate definition of this feature. 
Dave Raggett                                                           Page 10
HTML Tables                                                      7th July 1995
More advanced ways of specifying alignment
   If there are lots of cells, it rapidly becomes tedious and
   inefficient to explicitly specify the horizontal and vertical
   alignment attributes on each cell. A more compact alternative is to
   use the HSPEC and VSPEC elements to specify alignment properties for
   groups of matching cells. 
   HSPEC and VSPEC elements specify alignment properties for table
   cells and act like IF-THEN rules. The IF part is a conjunction of
   the following optional parts: 
   1.  whether the cell is in thead, tbody or tfoot (rowgroup) 
   2.  the class attribute of the current row (rowclass) 
   3.  whether the cell is a header or data cell (celltype) 
   4.  the class attribute of the cell itself (cellclass) 
   5.  the cell's row and/or column number (row or col) 
   If the cell straddles two or more rows or columns, the number of the
   first row/column is used for evaluating the match. 
   The THEN part sets the horizontal or vertical alignment for the
   cell's contents. The class attribute of the hspec or tspec element
   matching a cell can also be used by style sheets to attach
   additional rending properties to groups of cells. 
   Conflict resolution is real simple: 
   1.  properties defined as attributes on cells always override hspec
       or vspec 
   2.  hspec and vspec are lexically ordered from general to specific,
       i.e. the last matching hspec or vspec elements sets the cell's
       alignment properties 
   Some simple examples: 
   
           
           
   
   This example sets different alignments for cells in column 1
   depending on whether they are header or data cells. When several
   HSPEC elements match a given cell, the last one wins. Note that an
   explicit ALIGN attribute set on the cell itself always wins over any
   HSPEC elements. 
Dave Raggett                                                           Page 11
HTML Tables                                                      7th July 1995
   
           
           
   
   This example sets different alignments for cells in rows 1 to 3
   depending on whether they are in the THEAD or in the TBODY. When
   several VSPEC elements match a given cell, the last one wins. Note
   that an explicit VALIGN attribute set on the cell itself always wins
   over any VSPEC elements. 
Dave Raggett                                                           Page 12
HTML Tables                                                      7th July 1995
Autolayout Table Sizing Algorithm
   The layout algorithm for the incremental display mode has already
   been presented in a previous section. If the COLS attribute is
   missing from the table start tag, then the user agent should use the
   autolayout sizing algorithm, which uses two passes through the table
   data. 
   In the first pass, word wrapping is disabled, and the user agent
   keeps track of the minimum and maximum width of each cell. The
   maximum width is given by the widest line. As word wrap has been
   disabled, paragraphs are treated as long lines unless broken by  
   elements. The minimum width is given by the widest word or image
   etc. taking into account leading indents and list bullets etc. In
   other words, if you were to format the cell's content in a window of
   its own, determine the minimum width you could make the window
   before things begin to be clipped. 
   The minimum and maximum cell widths are then used to determine the
   corresponding minimum and maximum widths for the columns. These in
   turn, are used to find the minimum and maximum width for the table.
   Note that cells can contain nested tables, but this doesn't
   complicate the code significantly. The next step is to assign column
   widths according to the current window size (more accurately - the
   width between the left and right margins). 
   The table borders and intercell margins need to be included in the
   assignment step. There are three cases: 
   1.  The minimum table width is equal to or wider than the available
       space. In this case, assign the minimum widths and allow the
       user to scroll horizontally. For conversion to braille, it will
       be necessary to replace the cells by references to notes
       containing their full content. By convention these appear before
       the table. 
   2.  The maximum table width fits within the available space. In this
       case, set the columns to their maximum widths. 
   3.  The maximum width of the table is greater than the available
       space, but the minimum table width is smaller. In this case,
       find the difference between the available space and the minimum
       table width, lets call it W. Lets also call D the difference
       between maximum and minimum width of the table. 
       For each column, let d be the the difference between maximum and
       minimum width of that column. Now set the column's width to the
       minimum width plus d times W over D. This makes columns with
       lots of text wider than columns with smaller amounts. 
   This assignment step is then repeated for nested tables. In this
   case, the width of the enclosing table's cell plays the role of the
   current window size in the above description. This process is
Dave Raggett                                                           Page 13
HTML Tables                                                      7th July 1995
   repeated recursively for all nested tables. 
   If the table width is specified with the WIDTH attribute, the user
   agent attempts to set column widths to match. The WIDTH attribute
   should be disregarded if this results in columns having less than
   their minimum widths. 
   If relative widths are specified with the COLW element, the
   algorithm is modified to increase column widths over the minimum
   width to meet the relative width constraints.  
Dave Raggett                                                           Page 14
HTML Tables                                                      7th July 1995
HTML Table DTD
   The DTD or document type definition provides a formal definition of
   the allowed syntax for html tables. 
   
   
   
   
   
   
           
   
   
   
   
   
   
   
           
   
           
   
   
   
   
   
   
   
   
   
   
Dave Raggett                                                           Page 15
HTML Tables                                                      7th July 1995
   
   
   
   
   
   
   
   
   
   
   
Dave Raggett                                                           Page 16
HTML Tables                                                      7th July 1995
   
           
   
   
   
           %cell.halign;   -- horizontal alignment --
           %cell.valign;   -- vertical alignment --
           axis  CDATA  #IMPLIED   -- defaults to cell content --
           axes  CDATA  #IMPLIED   -- list of axis names --
           >
   
   
Dave Raggett                                                           Page 17
 |