property

max-height — CSS reference

Constrains physical vertical size with a upper bound. Initial none; not inherited. None removes this upper bound; a conflicting minimum takes precedence.

Formal Syntax & Structure

css syntaxcss
none | <length-percentage [0,∞]> | min-content | max-content | fit-content(<length-percentage [0,∞]>) (core values)

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS box geometry lab</title><style>body {margin:0} .sample {background:#dcebe9;color:#182e32}#a{height:100px;max-height:60px;width:120px} #b{height:80px;min-height:90px;max-height:60px;width:120px}</style><body><div id="a" class="sample"></div><div id="b" class="sample"></div></body></html>
CSS Reference