Last Updated : 11 Jul, 2025
The HTML <td> height Attribute is used to specify the height of the table cell. If the <td> height attribute is not set then it takes the default height according to content.
Note: The <td> height Attribute is not supported by HTML.
Syntax<td height="pixels | %">Attribute Values
Attribute Values
Description
pixels
It sets the height of the table cell in terms of pixels.
%
It sets the height of the table cell in terms of percentage (%).
HTML <td> height Attribute ExamplesExample 1: This example we use of the "height" attribute within table cells (td) to specify their height. Each row contains cells with different heights, affecting the table's overall appearance.
HTML
<!DOCTYPE html>
<html>
<head>
<title>HTML td height Attribute</title>
</head>
<body>
<h1>GeeksforGeeks</h1>
<h2>HTML td height Attribute</h2>
<table border="1" width="500">
<tr>
<th>NAME</th>
<th>AGE</th>
<th>BRANCH</th>
</tr>
<tr>
<td height="50">BITTU</td>
<td height="50">22</td>
<td height="50">CSE</td>
</tr>
<tr>
<td height="100">RAKESH</td>
<td height="100">25</td>
<td height="100">EC</td>
</tr>
</table>
</body>
</html>
Output:
HTML height AttributeExample 2: This example we demonstrates the usage of the "height" attribute within table cells (td) to specify their height as a percentage of the table row's height, maintaining consistency across cells.
HTML
<!DOCTYPE html>
<html>
<head>
<title>HTML td height Attribute</title>
</head>
<body>
<h1>GeeksforGeeks</h1>
<h2>HTML td height Attribute</h2>
<table
border="1"
width="500"
cellspacing="0"
cellpadding="8"
>
<tr>
<th style="height: 10%">NAME</th>
<th style="height: 10%">AGE</th>
<th style="height: 10%">
BRANCH
</th>
</tr>
<tr>
<td style="height: 10%">BITTU</td>
<td style="height: 10%">22</td>
<td style="height: 10%">CSE</td>
</tr>
</table>
</body>
</html>
Output:
Supported BrowsersRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4