English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag Directory

HTML td width attribute

The width attribute specifies the width of the table cell. Usually, the cell occupies the space required for its display content. The width attribute is used to set the predefined width of the cell.

 HTML <td> tag

Online Example

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 ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the width attribute.

Definition and Usage

HTML5 The <td> width attribute is not supported. Please use CSS instead.

In HTML 4.01 In HTML, the <td> width attribute is deprecated.

The width attribute specifies the width of the table cell.

By default, cells will occupy the space required for their displayed content. The width attribute is used to set a predefined width for the cell.

Compatibility Comments

In HTML 4.01 In the <td> width attribute is deprecated. Please use CSS instead.

CSS Syntax: <td style="width:100px">

CSS Example: Setting the width of table cells

In our CSS tutorial, you can find more about width attribute details.

Syntax

<td width="pixels|%">

Attribute Value

ValueDescription
pixelsSet the width value in pixels (e.g., width="50").
percentSet the width value as a percentage of the element's width (e.g., width="50%").
 HTML <td> tag