Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>CSS Set Maximum Height of an Element</title> <style> div { height: 200px; max-height: 100px; background: #bbb3ff; } p { max-height: 100px; background: #eee8aa; } </style> </head> <body> <div>The maximum height of this div element is set to 100px, so it can't be taller than that.</div> <p>Enter some more line of text to see how it works.</p> </body> </html>