max()
Takes the largest of the values — a way to set a lower limit.
Syntax
max(value, value, …)Parameters
| Parameter | Type | Description |
|---|---|---|
| values | length | Two or more values separated by commas. |
Examples
A minimum size that grows with the window:
<p style="font-size: max(16px, 1vw); padding: max(8px, 2vw); background: honeydew;">At least 16px text and 8px padding, more on wide screens</p>Notes
max() sets the minimum: the value never drops below the largest argument. For both limits at once, use clamp().
See also
In the tutorial
- CSS functions — Calculations right in CSS — calc(), min(), max() and clamp(), mixing units, fluid sizes and functions together with variables.