English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The HTML table width attribute specifies the width of the table. If the width attribute is not set, the table will occupy the space required to display the table data.
With 300 Pixel-width HTML Table:
<table width="300" border="1"> <tr> <th>Name</th> <th>Credits</th> </tr> <tr> <td>Zhang San</td> <td>90</td> </tr> <tr> <td>Li Si</td> <td>87</td> </tr> </table>Test See </›
IEFirefoxOperaChromeSafari
All major browsers support the width attribute.
HTML5 The <table> width attribute is not supported. Please use CSS instead.
The width attribute specifies the width of the table.
If the width attribute is not set, the table will occupy the necessary space to display the table data.
Tip:For practical purposes, it is best not to specify the width and use CSS to apply width (width)。
<table width="pixels|%">
Value | Description |
---|---|
pixels | Set the width in pixels (example: width="50")。 |
% | Set the width of the element as a percentage (example: width="50%")。 |