Open In App

CSS min-height Property

The min-height property in CSS is used to set the minimum height of an element. The min-height property is used when the content of the element is smaller than the min-height and if the content is larger than the min-height then it has no effect. This property ensures that the value of the height property is not less than the specified min-height value of the element in consideration. 

Syntax:



min-height: length|initial|inherit; 

Property Value:

Example: In this example, we are using the min-height: length property.






<!DOCTYPE html>
<html>
<head>
    <title>
        min-height property
    </title>
 
    <style>
        p {
            min-height: 10px;
            border: 1px solid black;
        }
    </style>
</head>
 
<body>
    <p>
        Prepare for the Recruitment drive of product
        based companies like Microsoft, Amazon, Adobe
        etc with a free online placement preparation
        course. The course focuses on various MCQ's
        & Coding question likely to be asked in the
        interviews & make your upcoming placement
        season efficient and successful.
    </p>
</body>
</html>

Output:

Example: In this example, we are using the min-height: initial property.




<!DOCTYPE html>
<html>
<head>
    <title>
        min-height property
    </title>
 
    <style>
        p {
            min-height: initial;
            border: 1px solid black;
        }
    </style>
</head>
 
<body>
    <p>
        Prepare for the Recruitment drive of product
        based companies like Microsoft, Amazon, Adobe
        etc with a free online placement preparation
        course. The course focuses on various MCQ's
        & Coding question likely to be asked in the
        interviews & make your upcoming placement
        season efficient and successful.
    </p>
</body>
</html>

Output:

Supported Browsers: The browser supported by min-height property are listed below:


Article Tags :