HTML td width attribute
Examples
Two with predefined width table cell:
<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>
<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"
Browser Support
All major browsers support width attribute.
Definition and Usage
HTML5 does not support the <td> width attribute. Use CSS instead.
In HTML 4.01, <td> width property is obsolete .
Attribute specifies the width of the table cell width.
Typically, the space occupied by the cell is that it requires the contents of display space. width property is used to set up predefined cell width.
Compatibility Notes
In HTML 4.01, <td> width property is obsolete. Use CSS instead.
CSS Syntax: <td style = "width: 100px">
CSS Example: set the table cell width
In our CSS tutorial you can find more information about the width attribute details.
grammar
<td width="pixels|%">
Property Value
值 | 描述 |
---|---|
pixels | 设置以像素计的宽度值(比如 width="50")。 |
percent | 设置以包含元素百分比计的宽度值(比如 width="50%")。 |
HTML <td> tag