HTML <td> widthAttribute

HTML td 标签参考手册HTML <td> tag

Examples

Two table cells with predefined widths:

<table border="1" width="100%">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td width="70%">January</td>
<td width="30%">$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</table>

Try it yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the width attribute.


Definition and Usage

HTML5 does not support the <td> width attribute. Use CSS instead.

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

The width attribute specifies the width of a table cell.

Usually, a cell takes up the space it needs to display its content. The width attribute is used to set a predefined width for the cell.


Compatibility Notes

In HTML 4.01, the width attribute of <td> is deprecated. Use CSS instead.

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

CSS example: Set the width of a table cell

In our CSS tutorial, you can find more details aboutthe width attributedetails.


Syntax

<td width="pixels|%">

Attribute Values

Value Description
pixels Sets the width in pixels (for example, width="50").
percent Sets the width as a percentage of the containing element (for example, width="50%").


HTML td 标签参考手册HTML <td> tag Other Extensions