MultiLength Attribute Type


 

The MultiLength Attribute Type is a data type defined by XHTML Modularisation 1.1, declared in the DTD as XML 1.0 type CDATA.
Reference: *W3C - XHTML Modularisation 1.1 - Attribute Types

Specific Attributes with Type MultiLength

  1. width:
    This is declared on the elements: col, colgroup

Common Attributes with Type MultiLength

There are no Common Attributes with type MultiLength.


Attribute Value for Type MultiLength

This is a length specified in pixels (e.g. "400"), as a percentage of the available horizontal space (e.g. "20%") or as a relative unit "d*" where d is an integer (e.g. "1*", "3*")

The only attributes with the MultiLength Attribute Type in XHTML 1.1 are the width attributes on the col and colgroup elements within a table and are used to control column widths.

Table columns are assigned widths according to the following:

  • If a width attribute is present on a col element, then that width is applied to each of the columns spanned.
    For example, with the code <col span="3" width="100" />, each of the three columns is given a width of 100 pixels.
  • Similarly, if a width attribute is present on a colgroup element, this does not mean that the colgroup itself will have that width, but instead that each of the columns in the colgroup is given that width.
    For example, for a <colgroup span="3" width="10%"></colgroup> element, each of the three columns within the group is given a width of 10%.
  • A width attribute specified on any child col element overrides any width on the parent colgroup element for the column(s) spanned by that col.

Once the allocated width for each table column has been determined, the horizontal space is divided as follows: pixel and percentage widths are allocated first and then the remaining space is distributed among the other columns in the proportions specified by the digits, d, in their relative unit widths. The special value 0* implies that the column should take up no more space than is required to render its contents. (Note that this means the entire table must be downloaded prior to rendering since there is no way of knowing what the maximum length of a column's data is in advance.) Also, the value * is equivalent to 1*.
In order to get proportional widths to work properly, it is usually required to include both a width attribute and the CSS style declaration table-layout:fixed on the enclosing table element. However, in my experience, still not all user agents treat relative units correctly and so I tend to avoid using them. In any case, it is probably best to specify widths in a stylesheet.

For more information, see the W3C HTML 4.01 Specification's section on *Calculating the width of columns.

Note: Just because you specify a width for a column does not guarantee that this is the width which will be displayed to the user. For example, columns with widths which are too small for their contents may be increased in width by the user agent.


Page Footer & Copyright

Copyright © Sally Maughan 2005-2009 (Page last updated on 01 Oct 2009)

*Valid XHTML 1.1 - hosted by *Openstrike

Content based on the W3C Working Draft: *XHTML 1.1 and Recommendation: *XHTML Modularisation 1.1.

W3C, XHTML, XML, HTML, CSS and MathML are *Trademarks of the W3C (*MIT, *ERCIM, *Keio) with which the site's author has no connection.


Up, Next & Previous Links

Your Location

Home > XHTML 1.1 Home > Data Types in XHTML 1.1 > Attribute Types (XHTML 1.1) > MultiLength Attribute Type