CSS - min-height


Advertisements


Description

The min-height property is used to set an lower bound on the height of an element.

Possible Values

  • length − Any length unit. The element can never have a value for height which is lower than this distance.

  • percentage − Limits the element's height to be at least this percentage of the height of the containing block.

Applies to

All the HTML elements except non-replaced inline elements and table elements.

DOM Syntax

object.style.minHeight = "50px"

Example

Here is the example −

<html>
   <head>
   </head>
   <body>
      <p style="width:400px; min-height:200px; border:1px solid red; padding:5px; margin:10px;">
      This paragraph is 400px wide and min height is 200px
      This paragraph is 400px wide and min height is 200px
      This paragraph is 400px wide and min height is 200px
      This paragraph is 400px wide and min height is 200px
      </p>
      
      <img alt="logo" src="/css/images/logo.png" width="95" height="84" />
   </body>
</html> 

This will produce following result −



Advertisements