About Lesson
min() Function in CSS:
The min() function returns the smallest value among the provided arguments. It’s helpful when you want to set a property value that shouldn’t exceed a specific size.
Syntax:
CSS
width: min(500px, 100%);
Example:
This ensures the element’s width will not exceed 500px, but if 100% of the container is smaller than 500px, it will take the smaller value:
CSS
.main {
width: min(500px, 100%);
}