CSS - min-height Property


CSS - min-height Property

  • The min-height property defines the maximum height of an html element like <h1>, <h2>, <p> tag etc. 
  • The estimation of the min-height property can be a number, a length, or a rate. 

Example:

p

width: 400px;
min-height: 100px;
border: 3px solid green;
}

Sample Code:

<!DOCTYPe html>
<html>
    <body>
        <p
style="min-height:100px; background-color:yellow">
            Welcome To Wikitechy.Best E-Learning website in the world.
        </p>
    </body>
</html>

Code Explanation:


    The Min-height property specifies the minimum length of a paragraph text, to prevent maximum height property overlapping height property. Here we have specified max-height property as 100px for paragraph tag.

    Background-color property in css is used to display a background color for an html element. Over here we have given background color property value as yellow for <p> element.

Output:


    Here the text “Welcome to Wikitechy. Best E-Learning Website in the world” appears with a minimum height of 100pixels and background color yellow appears for 100pixels as displayed in the browser window.