VOOZH about

URL: https://www.geeksforgeeks.org/css/css-max-function/

⇱ CSS max() Function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

CSS max() Function

Last Updated : 11 Jun, 2026

The CSS max() function returns the largest value from a list of comma-separated values. It is commonly used in responsive designs to ensure that an element's size does not go below a specified minimum value.

  • Returns the largest value from the specified list of values.
  • Allows combining different units such as pixels, percentages, and viewport units.
  • Helps create flexible and responsive layouts by choosing the maximum value automatically.

Syntax:

max(value1, value2, ...);

Parameters:

  • values: A set of comma-separated values from which the largest value is selected.

Return Value:

  • Returns the largest value from the specified set of comma-separated values.

Examples of CSS max() Function

Here are some examples discussed:

Example 1: When only 2 parameters are given.

Example 2: When more than two parameters are given in max() function.

Comment
Article Tags: