property
max-width — CSS reference
Constrains physical horizontal 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{width:100px;max-width:60px;height:120px} #b{width:80px;min-width:90px;max-width:60px;height:120px}</style><body><div id="a" class="sample"></div><div id="b" class="sample"></div></body></html>