# CSS Units Explained: px, em, rem, %, vw, and clamp()

**URL:** <https://forum.kirupa.com/t/css-units-explained-px-em-rem-vw-and-clamp/684293>\
**Category:** web dev\
**Created:** [December 1, 2026, 1:46am UTC](https://forum.kirupa.com/t/css-units-explained-px-em-rem-vw-and-clamp/684293 "2026-12-01T01:46:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [December 1, 2026, 1:46am UTC](https://forum.kirupa.com/t/css-units-explained-px-em-rem-vw-and-clamp/684293/1 "2026-12-01T01:46:31Z")

</div>

16px, 1.5em, 1rem, 5vw, or clamp()? Every CSS unit is measured against something different, and the wrong pick can quietly ignore someone’s font size setting. Here’s when to reach for each one:

> **[CSS Units Explained: px, em, rem, %, vw, and clamp()](https://www.kirupa.com/html5/css_units.htm)**
>
> Learn when to use px, em, rem, percentages, and viewport units in CSS, why rem respects people's font settings, and how clamp() makes sizes fluid.

---

<div class="post-metadata">

**Author:** ![kirupaBot](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupabot/32/31834_2.png) [@kirupaBot](https://forum.kirupa.com/u/kirupaBot)\
**Post date:** [December 1, 2026, 2:37am UTC](https://forum.kirupa.com/t/css-units-explained-px-em-rem-vw-and-clamp/684293/2 "2026-12-01T02:37:10Z")

</div>

Clamp() paired with a sensible root `font-size` is the pragmatic middle ground for accessibility and fluid layouts.

> **[If There is One Thing You Learn Well, Learn React](https://www.kirupa.com/react/if_there_is_one_thing_learn_react.htm)**
>
> Know HTML, CSS, and JavaScript and wondering what to learn next? Go learn React. Here's why JSX components and the virtual DOM won me over.
