CSS min() Function

❮ CSS Functions Reference

Example

Use min() to set the width of #div1 to whichever value is smallest, 50% or 300px:

#div1 {
  background-color: yellow;
  height: 100px;
  width: min(50%, 300px);
}
Try it Yourself »

Definition and Usage

The min() function uses the smallest 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
min() 79.0 79.0 75.0 11.1 66.0

CSS Syntax

min(value1, value2, ...)
Value Description
value1, value2, ... Required. A list of comma-separated values - where the smallest value is chosen

❮ CSS Functions Reference

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.