English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The width attribute specifies the width of the table cell. By default, the cell takes up the space required for its display content. The width attribute is used to set the predefined width of the cell.
Table cells with predefined width:
<table border="1" width="400"> <tr> <th>Month</th> <th>Savings</th> </tr> <tr> <td width="30%">January</td> <td width="70%">$1000</td> </tr> <tr> <td>February</td> <td>1280</td> </tr> </table>Test and see ‹/›
IEFirefoxOperaChromeSafari
Tutti i browser principali supportano l'attributo width.
HTML5 non supporta l'attributo width di <td>. Usa CSS invece.
In HTML 4.01, l'attributo width di <td> è obsoleto.
L'attributo width specifica la larghezza della cella della tabella.
Di solito, le celle occupano lo spazio necessario per il loro contenuto visualizzato. L'attributo width viene utilizzato per impostare la larghezza predefinita delle celle.
In HTML 4.01, l'attributo width di <td> è obsoleto. Usa CSS invece.
Sintassi CSS: <td style="width:100px">
Esempio CSS: Imposta la larghezza della cella della tabella
Nel nostro tutorial CSS, puoi trovare ulteriori informazioni su Attributo width dettagli.
<td width="pixel|%">
Valore | Descrizione |
---|---|
pixel | Imposta un valore di larghezza in pixel (ad esempio width="50"). |
percento | Imposta un valore di larghezza in percentuale per l'elemento (ad esempio width="50%"). |