VOOZH about

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

⇱ HTML <td> width Attribute - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

HTML <td> width Attribute

Last Updated : 22 May, 2026

The HTML <td> width attribute is used to specify the width of a table data cell.

  • The width can be given in pixels or percentage.
  • It controls how wide the table cell appears.
  • In modern HTML, CSS width property is preferred instead of the width attribute.

Syntax:

<td width="pixels | %">
  • pixels: It sets the width of the table in terms of pixels.
  • %: It sets the width of the table in terms of percentage (%).

Note: The <td> width Attribute is not supported by HTML5.

Example 1: Using Pixels for <td> Width

In the following example, we set the width of the first column in pixels.

Example 2: Using Percentage for <td> Width

In this example, we set the width of the first column as a percentage of the total table width.

HTML5 Deprecation Notice

The <td> width attribute is deprecated in HTML5 and is no longer recommended for modern web development. Instead of using the width attribute, developers should use CSS to set the width of table cells for better styling, flexibility, and responsiveness.

Here’s an example of how to set the width of a table cell using CSS:

Comment
Article Tags: