DevPrep
  • Interview Prep
  • Projects
  • Resources
  • Pricing
  • About Us
Submit Question
DevPrep
  • Pricing
  • About Us
Submit Question
← From Beginner to Expert in Fundamentals of Frontend
  • The Box Model
  • Specificity & The Cascade
  • CSS Units Deep Dive
  • Stacking Contexts & Z-Index
  • Flexbox Mastery
  • CSS Grid Mastery
  • Centering, Subgrid & Container Queries
  • CSS Custom Properties & Variables
  • Selectors: :has(), Pseudo-classes & Pseudo-elements
  • Responsive Functions: calc(), clamp(), min(), max()
  • Media Queries & Mobile-First Design
  • Transitions & Animations
  • Transforms, Filters & Clipping
  • CSS Methodologies: BEM, CSS-in-JS & Tailwind
  • Typography, Color Spaces & Dark Mode
  • CSS Performance & Optimization
  • CSS Interview Questions — Part 1
  • CSS Interview Questions — Part 2
← From Beginner to Expert in Fundamentals of Frontend

Responsive Functions: calc(), clamp(), min(), max()

14 min read
calc()clamp()min()max()Fluid TypographyResponsive DesignCSS Math

CSS Math Functions

These functions eliminate the need for many media queries by creating fluid, responsive values that scale automatically.

Function Reference

FunctionReturnsUse Case
calc()Computed value from expressionMixing units: calc(100% - 2rem)
min()Smallest valueResponsive max: width: min(600px, 90%)
max()Largest valueResponsive min: font-size: max(1rem, 2vw)
clamp()Middle value, clampedFluid typography: clamp(1rem, 3vw, 2rem)

clamp() Explained

clamp(MIN, PREFERRED, MAX)

  • MIN: The value will never go below this
  • PREFERRED: The ideal value (usually responsive like vw)
  • MAX: The value will never exceed this

Example: font-size: clamp(1rem, 2.5vw + 0.5rem, 2.5rem)

  • On mobile (320px): resolves to 1rem (minimum)
  • On tablet (768px): resolves to ~1.7rem (fluid)
  • On desktop (1920px): resolves to 2.5rem (maximum)

Practice

  • JavaScript
  • DSA
  • Machine Coding
  • System Design

Resources

  • Learning Tracks
  • Articles
  • Roadmaps
  • Compare Concepts
  • Glossary
  • Developer Tools
  • All Questions

Company

  • About
  • Pricing

Legal

  • Privacy Policy
  • Terms of Service
DevPrep

© 2026 DevPrep. All rights reserved.