Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

CSS Functions – calc(), clamp(), min(), | CSS Course lesson | BraveProgrammer
  1. Courses
  2. /
  3. CSS Course

Lesson 25 of 50

·css

CSS Functions – calc(), clamp(), min(), max()

8 mins

Course progress50%

What you'll learn

Keep these ideas in mind as you work through the lesson.

2 points
  • `calc()` can mix units (`%` + `px`).
  • `clamp()` is perfect for responsive typography and spacing. * `min()`/`max()` are useful for grid gutters and container widths.

Functions let you perform calculations directly in CSS.

  • calc() – arithmetic (width: calc(100% - 2rem);).
  • clamp(min, val, max) – fluid values with hard limits.
  • min() / max() – pick the smallest or largest of a list.

Example: Fluid padding with clamp

section { padding: clamp(1rem, 2vw, 3rem); }
Make it stickPractice what you've learned1 quiz · 6 practical tests · Optional activities from CSS CourseBrowse activities
Previous lessonCSS Custom Properties (Variables)Continue to lesson 26Logical Properties & Writing ModesBack to CSS Course curriculum