i2tutorials

CSS max-height

CSS max-height

 

The max-height CSS property defines the maximum height of the content area of an element. Max-height does not include padding, borders, or margins.

 

Syntax:

 

max-height:     length | percentage | none | initial | inherit

 

Property Values:

 

 

Example:

 

<!DOCTYPE html>
<html>
<head>
<title>
max-height property
</title>

<style>
p{
border: 4px solid blue;
background-color: lightblue;
font-size: 20px;
}
#px {
max-height: 60px;
}
#em {
max-height: 6em;

}
</style>
</head>
<body>
<h2> max-height: 60px; </h2>
<p id = "px">
Hi, Welcome to the I2Tutorials. Enter content here.Enter content here.Enter content here.Enter content here.Enter content here.Enter content here.Enter content here.Enter content here.Enter content here.Enter content here.Enter content here.Enter content here.Enter content here.Enter content here.Enter content here.
</p>
<br>
<h2> max-height: 6em; </h2>
<p id = "em">
Hi, Welcome to the I2Tutorials. Enter content here.Enter content here.Enter content here.Enter content here.Enter content here.Enter content here.Enter content here.Enter content here.Enter content here.Enter content here.Enter content here.Enter content here.Enter content here.Enter content here.Enter content here.Enter content here.
</p>

</body>
</html>

 

OUTPUT:

 

CSS max-height

 

 

Exit mobile version