HTML and CSS Reference
In-Depth Information
1. For each cell in a column, calculate both the minimum and maximum cell width.
2. Determine the minimum width required to display the content. In determining the minim-
um content width, the content can flow to any number of lines, but it may not stick out of
the cell's box. If the cell has a width value that is larger than the minimum possible width,
the minimum cell width is set to the value of width . If the cell's width value is auto , the
minimum cell width is set to the minimum content width.
3. For the maximum width, determine the width required to display the content without any
line-breaking, other than that forced by explicit line-breaking (e.g., due to the <br> ele-
ment). That value is the maximum cell width.
4. For each column, calculate both the minimum and maximum column width.
a. The column's minimum width is determined by the largest minimum cell width of the
cells within the column. If the column has been given an explicit width value that is
larger than any of the minimum cell widths within the column, the minimum column
width is set to the value of width .
b. For the maximum width, take the largest maximum cell width of the cells within the
column. If the column has been given an explicit width value that is larger than any
of the maximum cell widths within the column, the maximum column width is set to
the value of width . These two behaviors recreate the traditional HTML table behavior
of forcibly expanding any column to be as wide as its widest cell.
5. In cases where a cell spans more than one column, the sum of the minimum column widths
must be equal to the minimum cell width for the spanning cell. Similarly, the sum of the
maximum column widths must equal the spanning cell's maximum width. User agents
should divide any changes in column widths equally among the spanned columns.
In addition, the user agent must take into account that when a column width has a percentage
value for its width , the percentage is calculated in relation to the width of the table—even
though that width is not known yet. The user agent must hang on to the percentage value and
use it in the next part of the algorithm. Once the user agent has determined how wide or nar-
row each column can be, it can calculate the width of the table. This happens as follows:
1. If the computed width of the table is not auto , the computed table width is compared to
the sum of all the column widths plus any borders and cell-spacing. (Columns with per-
centage widths are likely calculated at this time.) The larger of the two values is the fi-
nal width of the table. If the table's computed width is larger than the sum of the column
widths, borders, and cell-spacing, all columns are increased in width by an equal amount
so they fill the computed width of the table.
Search WWH ::




Custom Search