ALL SYSTEMS ONLINE / NewAHU Graphic Builder — configure any AHU and export native Niagara PX · $749, 25 exports included Try it live →
All insights
NIAGARAUI / INSIGHTS

Relative Units Explained: em, rem, and %

When to reach for em, when for rem and when a percentage is the right answer - a plain-English guide to relative units and the sizing bugs they prevent.
Abstract illustration of nested squares scaling down, representing relative CSS units
LIVE UNIT PLAYGROUND Niagara UI - CSS Units
DEMO Drag the slider to change the parent font-size
160px
Fixed px
10em
em - parent relative
10rem
rem - root relative
50%
% - container relative

The em box grows or shrinks with the slider above. rem and % stay put because they measure from the document root and from their own container, not from the nearby parent.

CSS gives you several ways to size text and elements relative to something else, and picking the right one keeps a design flexible. Here is a quick reference for the units used across Niagara UI templates.

 

em is relative to the font size of the current element's parent, which makes it useful for spacing that should scale alongside nearby text, but it can compound unexpectedly when nested.

 

rem is relative to the root html element's font size, so it stays predictable no matter how deeply an element is nested. Most of our components default to rem for font sizes and spacing.

 

Percent (%) is relative to the parent container's corresponding dimension, commonly used for widths and heights in fluid layouts.

 

Viewport units like vw and vh are relative to the browser viewport size, useful for full-bleed sections or hero banners.

 

As a rule of thumb: use rem for typography and consistent spacing, % for fluid container widths, and reserve em for small tweaks relative to a nearby element.

← Back to insightsBack to top ↑

More ideas. A clearer view.

All insights ↗
Dashboard

NODE Tutorial: Read Power Distribution and Understand PUE

Follow NODE from Overview to Power: calculate a PUE indicator, compare facility and IT load, read electrical capacity in context, and record an act...

Dashboard

THERMA Tutorial: Understand Plant Efficiency, Delta T, and Pump Power

Use THERMA to calculate whole-plant kW/ton, read chilled-water delta T, and understand the contribution of pumps before drawing an efficiency concl...

Dashboard

ATRIUM Tutorial: Check Classroom Conditions with System View

Learn a repeatable school-building review in ATRIUM: select the correct floor, interpret scoped conditions, inspect AHU readings, and prepare a cle...