width is set, a
th (and also
td) will take up only the width it requires (obviously this will
depend on the amount of content in each of the table cells). You can use
width attribute to fix the width to a value of
your choosing, regardless of the content of the table cell, but be aware
that this is a deprecated attribute. Width should be set using
width attributes are applied to several cells
within the same column, the browser will render the column with the
largest width value specified. It could be understood, therefore, that
width is really a minimum width value: a table cell
will increase in size if the content cannot be wrapped (as may be the
case, for example, with a wide image, or a string of text that contains no
spaces, such as a web site address).
width attribute is set to
<table> <tr> <th width="50%">Account Type</th> <th width="50%">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>
This attribute takes as
its value a number that represents the width of the
element in pixels, or a percentage.
It causes no compatibility issues, and has excellent support across all tested browsers.