Design9 min read
px vs em vs rem in CSS: Which Unit to Use and When
px is an absolute pixel, em is relative to the element's own font-size, rem is relative to the root. Default to rem for accessibility — here is why and when.
M H Tawfik
Toolk Blog
Practical, no-fluff posts from the team building Toolk — written for developers, designers, and creators who want to ship faster.
px is an absolute pixel, em is relative to the element's own font-size, rem is relative to the root. Default to rem for accessibility — here is why and when.
HEX and RGB are the same sRGB color in different notation, HSL is a human-friendly transform, and OKLCH is perceptually uniform. Here is when to use each.