2.1.12 [HTML] Section 11.2.1, The TABLE element
C0001:
-
If any of the columns are specified in relative or percentage terms (see the section on calculating the width of columns), authors must also specify the width of the table itself.
All Document Modes (All Versions)
If the width of the table is not specified, the columns are sized according to their contents. The column with the largest ratio of actual content width to percentage width is used to resize other columns according to their specified width percentage values. For more information on table layout algorithms, see [MS-CSS21] section 2.1.86.
For example, the following table uses ratios of actual column content width to percentage width of 10 and 20, respectively.
-
<table> <tr> <td width="30%">12</td> <td width="70%">12345678901234</td> <tr> <td width="30%">123</td> <td width="70%">1</td> </table>
This renders as
12 |
12345678901234 |
---|---|
123 |
1 |
(Grid lines are added to the table for clarity.)
The following table uses column ratios of 20 and 17.1, respectively.
-
<table> <tr> <td width="30%">1234</td> <td width="70%">123456789012</td> <tr> <td width="30%">123456</td> <td width="70%">1</td> </table>
This renders as
1234 |
123456789012 |
---|---|
123456 |
1 |
(Grid lines are added to the table for clarity.)