DEV Community

Takuya Kikuchi
Takuya Kikuchi

Posted on

TIL: ex and ch CSS relative length units


CSS relative length units

ch: the width of "0" of the element's font
ex: the height of "x" of the element's font

CSS values and units - Learn web development | MDN

When to use them 🤔

They are interesting, but don't know when to use them.
ex seems like it can be a good choice for approximating line length of some paragraphs.
But I think I will just use % instead for width.

Discussion (0)