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

HTML Reference Manual

HTML Tag Reference

HTML: <th> width attribute

<th> width attribute usage, width specifies the width of the table header cell, online examples demonstrate how to use the <th> width attribute, browser compatibility, syntax definition, and detailed information about its attribute values, etc.

 HTML <th> tag

Online Example

Table header cells with predefined widths:

<table style="width:100%" border="1">
  <tr>
    <th width="70%">Year</th>
    <th width="30%">Savings</th>
  </tr>
  <tr>
    <td>2019</td>
    <td>80000 Yuan</td>
  </tr>
  <tr>
    <td>2018</td>
    <td>70000 Yuan</td>
  </tr>
</table>
Test to see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the width attribute.

Definition and Usage

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

In HTML 4.01 In this document, the width attribute of <th> is deprecated.

The width attribute specifies the width of the table header cell.

By default, the space occupied by a cell is the space required to display its content. The width attribute is used to set a predefined width for the cell.

Compatibility Notes

In HTML 4.01 In this document, the width attribute of <th> is deprecated. Please use CSS instead.

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

CSS Example: Set the width of the table header cell

In our CSS tutorial, you can find more aboutwidth Attribute details.

Syntax

<th width="pixels|%">

Attribute Value

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