You are here: Reference > CSS > properties > min-height

min-height property

Browser support:
Specifies a minimum height for the visible area of an element.
This property has effect only on block-level elements or on elements with absolute or fixed position. The min-height property contains only the pure height of the visible content, without the padding, scrollbar, border and the margin. The height of an element can never be less than the value specified by the min-height property.
Note, this property works differently in Internet Explorer, depending on the document type declaration. For example:
it does not work in case of the HTML 4.01 Transitional document type
it works in case of HTML5 and XHTML 1.1 document types in Internet Explorer from version 8, but does not work for td elements in Internet Explorer before version 8. See Example 1 and 2. For a detailed description of document types, see the page for the !DOCTYPE element.
You can specify a range for the size of an element with the min-width, min-height, max-width and max-height properties. If you want to specify the exact size of an element, use the width and height properties.
JavaScript page for this property: minHeight. You can find other example(s) there.

Possible values:

 One of the following values: 
height in non-negative length
The minimum height for the element in length units. For the supported length units, see the length page.
height in non-negative percentage
The minimum height for the element is the specified percentage of the height of the parent element.
inherit
Takes the value of this property from the computed style of the parent element.
Default: 0.

Example HTML code 1:

This example illustrates the use of the min-height property:
<!DOCTYPE html>
<html>
    <head>
        <style>
            .minHeight {
                min-height: 100px;
                overflow: auto;
                border: 3px solid red;
            }
        </style>
    </head>
    <body>
        <table>
            <tr>
                <td class="minHeight">
                    The min-height style property of this <b>table cell</b> is '100px'.
                    <div style="height:30px; background-color:green;">The height of this green field is 30px.</div>
                </td>
            </tr>
        </table>
        <div class="minHeight">
            The min-height style property of this <b>division element</b> is '100px'.
            <div style="height:30px; background-color:green;">The height of this green field is 30px.</div>
        </div>
    </body>
</html>
Did you find this example helpful? yes no

Example HTML code 2:

This example is equivalent to the previous one, but it uses the HTML 4.01 Transitional document type so the min-height property does not work for td elements in Internet Explorer before version 8:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <style>
            .minHeight {
                min-height: 100px;
                overflow: auto;
                border: 3px solid red;
            }
        </style>
    </head>
    <body>
        <table>
            <tr>
                <td class="minHeight">
                    The min-height style property of this <b>table cell</b> is '100px'.
                    <div style="height:30px; background-color:green;">The height of this green field is 30px.</div>
                </td>
            </tr>
        </table>
        <div class="minHeight">
            The min-height style property of this <b>division element</b> is '100px'.
            <div style="height:30px; background-color:green;">The height of this green field is 30px.</div>
        </div>
    </body>
</html>
Did you find this example helpful? yes no

Supported by tags:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content