min-height Attribute | minHeight

HTML (DHTML)

min-height Attribute | minHeight Property

Internet Development Index

Sets or retrieves the minimum height for an element.

Syntax

HTML { min-height : sMinHeight }
Scriptingobject.style.minHeight(v) [ = sMinHeight ]

Possible Values

sMinHeightVariant that specifies or receives the minimum height for an element.
lengthFloating-point number followed by an absolute units designator (cm, mm, in, pt, pc, or px) or a relative units designator (em or ex). For more information about the supported length units, see CSS Length Units.
percentageInteger followed by a % that specifies a percentage of the containing block height to use as the minimum height of the element. If the height of the containing block is not explicitly set, then the element has no minimum height and the minHeight property is interpreted as 0%. For more information on containing blocks and how its height is computed, see the Cascading Style Sheets, Level 2 (CSS2) Non-Microsoft link specification.

The property is read/write for all objects except the following, for which it is read-only: currentStyle. The property has no default value. The Cascading Style Sheets (CSS) attribute is not inherited.

Remarks

With Internet Explorer 6, this property applies only to td, th and tr elements in fixed-layout tables. Auto-layout tables are the default. To create a fixed-layout table, set the tableLayout property of a table element to fixed. The advantage of fixed-layout tables is they render faster than auto-layout tables.

Example

The following example shows the benefits of using the min-height attribute over the HEIGHT attribute for a TR element.

<HTML>
<HEAD>
<TITLE>CSS Min-Height Property Example</TITLE>
</HEAD>
<BODY>
<table border="1" style="table-layout:fixed; width:100%;">
<tr>
<td style="height:35px;background-color:#99CCFF">This cell has the
<b>height</b> attribute set to 35px. In Internet Explorer, overflow text
is clipped when <b>height</b> is set on cells or rows in fixed-layout tables.
Setting the <b>min-height</b> attribute, however, accomodates overflow text
by increasing the cell or row height.</td>
</tr>
<tr>
<td style="min-height:35px;background-color:#99CCFF">This cell has the
<b>min-height</b> attribute set to 35px. In Internet Explorer, overflow text
is clipped when <b>height</b> is set on cells or rows in fixed-layout tables.
Setting the <b>min-height</b> attribute, however, accomodates overflow text
by increasing the cell or row height.</td>
</tr>
</table>
</BODY>
</HTML> 
This feature requires Microsoft® Internet Explorer 6 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

Standards Information

This property is defined in Cascading Style Sheets (CSS), Level 2 (CSS2) Non-Microsoft link.

Applies To

currentStyle, style, runtimeStyle, TD, TH, TR

See Also

CSS Enhancements in Internet Explorer 6, height