# CSS max() Function
The CSS max() function is used to set the largest value among the given values as the property value.
## CSS Syntax
```css
selector {
property: max(value1, value2, ...);
}
## Parameter Description
- **value1, value2, ...**: One or more values separated by commas. The function will select the largest value.
## Example
### Example 1
Use max() to set the width:
#myDIV {
height: 200px;
background-color: yellow;
}
#myP {
background-color: pink;
height: 100px;
width: max(50%, 300px);
}
### Example 2
Use max() to set multiple values:
#myDIV {
height: 200px;
background-color: yellow;
}
#myP {
background-color: pink;
height: 100px;
width: max(50%, 300px, 200px);
}
## Browser Support
The numbers in the table indicate the first browser version that fully supports this function.
| Chrome | Firefox | Safari | Edge | Opera |
|--------|---------|--------|------|-------|
| 79.0 | 75.0 | 13.1 | 79.0 | 66.0 |
## Related Functions
- [CSS min() Function](#) - Set the smallest value
- [CSS calc() Function](#) - Perform calculations
## More Examples
### Responsive Width
Use max() to create a responsive layout:
.container {
width: 100%;
max-width: 1200px;
margin: 0 auto;
}
.box {
width: max(20%, 200px);
float: left;
padding: 10px;
box-sizing: border-box;
}
### Font Size
Use max() to set font size:
h1 {
font-size: max(2rem, 5vw);
}
Responsive Heading
## Notes
1. The max() function can be used with any CSS property that accepts length, frequency, angle, time, percentage, number, or integer values.
2. When using max() with percentage values, the percentage is calculated relative to the parent element's corresponding dimension.
3. The max() function is part of the CSS Values and Units Module Level 4.
## Related Resources
- (https://www.w3.org/TR/css-values-4/#math-functions)
- [MDN Web Docs - max()](https://developer.mozilla.org/en-US/docs/Web/CSS/max())
## Related Search
- [CSS min() function](#)
- [CSS calc() function](#)
- [CSS clamp() function](#)
## Comment