function

max() — CSS reference

Select the largest compatible argument. For a fluid width this establishes a floor; a fixed floor can overflow a narrow container. Negative numbers are compared by numerical order, not absolute magnitude.

Formal Syntax & Structure

css syntaxcss
max(<calc-sum>#)

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS math lab</title><style>body {margin:0} .sample {height:12px;background:#006050}.parent {width:300px} .sample {width:40px;margin-bottom:4px} #a {width: max(40%, 100px)} #b {width: max(20%, 100px)}</style><body><div class="parent"><div id="a" class="sample"></div><div id="b" class="sample"></div></div></body></html>
CSS Reference