CSS Units (px / rem / em / vw) Playground

Type a font-size in any unit and watch the browser compute its px. What becomes of em in a nested menu, rem when the text is enlarged, vw on a phone screen?…

Why it matters

The wrong unit = text that ignores the user’s setting (accessibility), a menu that swells, or a title that shrinks to nothing on a phone. Knowing each unit’s base = knowing what happens before you try it.

The key idea

rem from the root, em from the parent, vw from the window

Common mistakes

Try it in this playground