Relative unit
A relative unit is a CSS length unit whose value is determined in relation to a contextual reference, such as a font size, parent dimension, container, or viewport.
Architecting Accessibility
A relative measurement unit specifies a size in relation to another value, such as a parent dimension, root size, or viewport.
- How it is used
- Supports text resizing and zoom by sizing fonts, spacing, and containers relative to user or layout values.
- How deep it goes
- Explains em, rem, and percentages for fonts and spacing, then demonstrates rem-based sizing alongside fixed-pixel styling.
- Examples
- Contrasts rem-based root, body, and heading rules with fixed-pixel body and heading sizes.
- What you can do after
- Apply relative CSS units to size text and spacing while supporting user font preferences and adaptable containers.
Read how Architecting Accessibility explains relative unit →
Tiny CSS Projects
A relative unit is a CSS length unit whose computed size depends on another value, such as the element's font size.
- How it is used
- Scales typography, padding, and margins with text size while reserving fixed units for measurements that should not change.
- How deep it goes
- Explains relative sizing through blockquote and form examples, but does not develop unit computation internals.
- Examples
- Uses a styled blockquote and text-input form controls to contrast scalable spacing with a fixed border.
- What you can do after
- Build it from scratch by choosing relative units for text-dependent spacing and fixed units for invariant details.
Also covered in
- Vanilla WebIn early access (MEAP)
- Design for Developers
What to know first
- remThe rem is a CSS relative length unit whose value equals the computed font size of the document’s root element.
Related concepts
- absolute unitalternative to · An absolute CSS length unit has a fixed reference magnitude or defined relationship to physical or CSS reference lengths rather than depending on surrounding layout.
- pixelcontrasts with · A pixel is either a discrete image sample carrying visual information at a raster location or, in CSS, an abstract reference unit for rendered dimensions.
- text scalingused by · Text scaling is the enlargement or reduction of displayed text through user or system settings to accommodate visual needs.
- remincludes · The rem is a CSS relative length unit whose value equals the computed font size of the document’s root element.
- responsive typographyused by · Responsive typography is the practice of adapting text sizing and related typographic properties to different viewport, device, or display conditions.
Questions about relative unit
What is relative unit?
A relative unit is a CSS length unit whose value is determined in relation to a contextual reference, such as a font size, parent dimension, container, or viewport.
Which Manning books explain relative unit?
Architecting Accessibility and Tiny CSS Projects.
What should I know before learning relative unit?
Manning books that teach relative unit usually introduce rem first.
What is the difference between relative unit and absolute unit?
A relative unit is a CSS length unit whose value is determined in relation to a contextual reference, such as a font size, parent dimension, container, or viewport. An absolute CSS length unit has a fixed reference magnitude or defined relationship to physical or CSS reference lengths rather than depending on surrounding layout.
What kinds of relative unit are there?
Kinds of relative unit include rem.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

