Course Content
CSS Basic
0/1
CSS Selectors
0/1
CSS Comments
0/1
CSS Backgrounds
0/1
CSS Borders
0/1
CSS Outline
0/1
CSS Fonts
0/1
CSS Height and Width
0/1
CSS Margins and Paddings
0/2
CSS Icons
0/1
CSS Links
0/1
CSS Lists
0/1
CSS Tables
0/1
CSS Display Properties
0/1
CSS Max-Width Property
0/1
CSS Positioning Elements
0/1
CSS Z-Index Property
0/1
CSS Overflow
0/1
CSS Float
0/1
CSS Opacity
0/1
CSS Forms
0/1
CSS Dropdowns
0/1
CSS Buttons
0/1
CSS Media Queries
0/1
About Lesson

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%);
}