System.Web.UI.HtmlControls Namespace HtmlTableCell Class
Sets or retrieves the height of an HtmlTableCell control.
Inline |
<th | td height = intHeight | %Height ... > |
Script |
HtmlTableCell.Height [ = intHeight | %Height ] |
intHeight |
Integer specifying the object height, in pixels. |
%Height |
Value expressed as a percentage of the parent object's height. |
The property is read/write with no default value.
Use the Height property to control the displayed height of the HtmlTableCell control.
When you specify the height of a cell, all cells in the same row automatically share that height.
By default, height is expressed in pixels, but can also be expressed as a percentage of the containing object, which is the HtmlTable. Heights expressed as percentages are based on the vertical space currently available, not on the natural size of the table. For example, if the browser window is resized, the table is resized accordingly.
Note, though, that this property always retrieves the height in pixels.
If you specify a height that is smaller than is required to display the contents of the HtmlTableCell, this property is ignored.
The below code shows how to declaratively set the Height of an HtmlTableCell at design time.
<table cellspacing=1 runat="server">
<tr>
<th height="100">Table header</th></tr>
<tr>
<td>Table data</td></tr>
</table>
The following example demonstrates how to programmatically set the Height of the first cell in the first row of an HtmlTable at run time, based on a selected value.
myTable.Rows [ 0 ].Cells [ 0 ].Height = heightSelect.Value + "%";
Show me
HtmlTableCell Members Width NoWrap