CSS Values and Units
Every property in CSS takes a value. Understanding the different types of values—lengths, percentages, colors, and functions—is crucial for building flexible, responsive interfaces.
Absolute vs. Relative Lengths
Absolute units (like px, cm) are fixed. A pixel is a pixel, regardless of other settings. Relative units (like em, rem, %) scale relative to something else—font size or parent width.
The Power of REM
rem stands for "Root EM". It is relative to the font-size of the root element (<html>). This makes it the gold standard for accessible sizing and global scaling.
Functional Notation
CSS offers functions to calculate values dynamically. calc() lets you perform math (e.g., `100% - 20px`). var() allows you to use Custom Properties (variables) to store and reuse values like colors or spacing tokens.
