ELSEIF
Your brief EB
178 stories from 125 feeds 522 clusters Refreshed 13 minutes ago next pull 15:39

TECH Signal 507

Using ch and ex units instead of px creates proportional CSS text layouts

Illustration only Photo by Kimon Maritz on Unsplash

A developer proposes replacing CSS pixel units with ch and ex units to ensure layout dimensions remain proportional to the text size rather than relying on perceptual pixel measurements.

WHY IT MATTERS

CSS pixels are perceptual units that do not map one-to-one with physical device pixels, which can complicate text-heavy layouts. Using ch for horizontal spacing and ex for vertical spacing ties the layout directly to the typography, ensuring readability across different devices.

Written by elseif from the cluster below · every claim links back to a source

The three things worth knowing

01

CSS pixels are perceptual units that do not correspond to physical device pixels.

02

The ch unit bases horizontal dimensions on character width to keep layouts proportional to text.

03

The ex unit bases vertical dimensions on the height of a typical lower-case letter.

THE CLUSTER

Same story, 1 feed.

ORDERED BY FIRST SEEN
shkspr.mobi via Hacker News Death to px, long live ch Open ↗