CSS Units
CSS uses many units for sizes. Choosing the right one matters for responsive design.
Absolute Units
| Unit | Description |
|---|---|
px | Pixel — fixed size, most common absolute unit |
Relative Units
| Unit | Relative To |
|---|---|
% | Parent element's size |
em | Parent's font-size |
rem | Root (html) font-size (usually 16px) |
vw | 1% of viewport width |
vh | 1% of viewport height |
💡 Use rem for font sizes and spacing — it scales well when users change browser font size.