width (HTML attribute)
Example
The width
attribute set to "400" (pixels):
<table width="400"> <tr> <th>Account Type</th> <th>Interest Rate</th> </tr> <tr> <td>Smart</td> <td>From 2%</td> </tr> <tr> <td>Young Saver</td> <td>From 1.6%</td> </tr> </table>
Description
Unless a
width is set, a table will take
up only as much width as it requires (obviously this will very much depend
on the amount of content in each of the table cells). Browser support for
this attribute is excellent - whether the dimension is set as pixels or
percentage - but, like many other attributes that the
table element has, it is better to use CSS to set the
table’s width.
Value
A number representing the width of the
table in pixels or a percentage.
Compatibility
| IE | 5.5 | Full |
|---|---|---|
| 6.0 | Full | |
| 7.0 | Full | |
| Firefox | 1.0 | Full |
| 1.5 | Full | |
| 2.0 | Full | |
| Safari | 1.3 | Full |
| 2.0 | Full | |
| 3.0 | Full | |
| Opera | 9.2 | Full |
| 9.5 | Full |
Causes no compatibility issues. It has excellent support across all tested browsers.
User-contributed notes
There are no comments yet.
Add a note
To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

