Setting Maximum height

You can use the max-height property to set maximum height.

  • auto
  • <length>
  • <%>

auto is to let the browser do the calculation.

 
<!DOCTYPE HTML> 
<html> 
    <head> 
        <title>Example</title>  
        <style type="text/css"> 
        p { 
            background: lightgray; 
            border: 4px solid black; 
            margin: 2px; 
            box-sizing: border-box; 
            min-width: 100px; 
            width:50%; 
            max-height: 200px; 
        } 
        </style> 
    </head>
    <body> 
            <p> 
                    HyperText Markup Language (HTML) is the main markup language for 
                    displaying web pages and other information that can be displayed 
                    in a web browser(From From Wikipedia, the free encyclopedia).
            </p>         
    </body> 
</html>
  
Click to view the demo
Home 
  HTML CSS Book 
    CSS  

Size:
  1. Controlling the Size of an Element
  2. Setting Minimum height
  3. Setting Minimum width
  4. Setting Maximum width
  5. Setting Maximum height
  6. Setting the Sized Box
Related: