VOOZH about

URL: https://www.geeksforgeeks.org/html/html-th-width-attribute/

⇱ HTML <th> width Attribute - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

HTML <th> width Attribute

Last Updated : 22 May, 2026

The width attribute in the <th> tag is used to specify the width of a header cell. It was commonly used in older HTML but is now deprecated in HTML5.

  • Specifies the width of a header cell.
  • Value can be in pixels or percentage.
  • Used only with the <th> element.

Note: The width attribute is deprecated in HTML5; use CSS (width) instead.

Syntax

<th width="pixels | %">

Attribute Values

  • pixels: Sets the width of the header cell in pixels.
  • %: Sets the width of the header cell in percentage (%).

Example: In this example, the <th> width attribute sets column widths to 50%, 20%, and 30% of the table.

Example: In this example, the <th> width attribute sets 100px for “Header 1,” 200px for “Header 2,” and the remaining space for “Header 3.”

Comment
Article Tags: