Using the WIDTH Attribute on Tables
The use of tables to display information can greatly enhance the way users view certain data. Use the WIDTH attribute to set the size of the table in the window. The best way to control the table size is to use pixel values for the WIDTH attribute. Nested tables are supported.
If you choose to leave out the WIDTH attribute, the table is rendered according to the following rules:
- If the Default Layout menu option is selected, the table fits perfectly to the screen width when the table contents can be scaled down.
- If Default Layout menu option is not selected, Internet Explorer Mobile uses a virtual screen width of 640 pixels and renders the table to a width of 640 pixels.
Note If the One Column Layout menu option is selected, the table may not display as expected. For more information about Layout menu options, see Layout Meta Tag.
Unless there is a specific reason for having table or cell widths, it is recommended that width values be omitted.
In Internet Explorer Mobile, with the Default option selected, the WIDTH attribute on tables and table cells might not be honored if it would result in the table being wider than the screen. When this happens, the pixel widths specified for the table columns via the WIDTH attribute on table cells are evenly reduced until all columns fit horizontally into the available screen width or until the minimum possible width is reached for all columns. Consider the following HTML example:
<body>
<table width="300" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100">column 1</td>
<td width="100">column 2</td>
<td width="100">column 3</td>
</tr>
</table>
</body>
If the screen is only 240 pixels wide on the device, with Default on, the table cannot be 300 pixels wide. Accounting for the 4-pixel left and right margin on the <body> element, the maximum width available to the table without scroll bars is 232 pixels, so the table behaves as if the WIDTH attribute wasn't specified at all. The column' widths are proportionally reduced so that they sum to 232. Column 1 reduces to 78 pixels wide, and columns 2 and 3 reduce to 77 pixels each.
See Also
<object> Tag Limitations | Designing Images and Sound for Windows Mobile–based devices | HTML Reference for Internet Explorer Mobile | Mobile Web Site Design Overview | Internet Explorer Mobile Overview
Send Feedback on this topic to the authors