On this page
  1. calc()
  2. Syntax & Overview
  3. Notes & Best Practices
  4. Example

calc()

Prev: math | Up: math | Next: `clamp()`
Rel: math, Math & Sizing Functions Guide
Ref: MDN Web Docs — calc()
Tags: #public #web #css #functions #math #tier/core


Syntax & Overview

calc(100% - 2rem)

Evaluates arithmetic (+, -, *, /) across mixed CSS units.

Notes & Best Practices

Example

.sidebar { width: calc(100% - 2rem); max-width: calc(20ch + 4rem); }

Linked from

Related notes