CSS max() Function
Example
Use max() to set the width of #div1 to whichever value is largest, 50% or 300px:
#div1 {
background-color: yellow;
height: 100px;
width: max(50%, 300px);
}
Try it Yourself »
Definition and Usage
The max() function uses the largest value, from a comma-separated list of values, as the property value.
Version: | CSS3 |
---|
Browser Support
The numbers in the table specify the first browser version that fully supports the function.
Function | |||||
---|---|---|---|---|---|
max() | 79.0 | 79.0 | 75.0 | 11.1 | 66.0 |
CSS Syntax
max(value1, value2, ...)
Value | Description |
---|---|
value1, value2, ... | Required. A list of comma-separated values - where the largest value is chosen |
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.