This issue has been really vexing me for a while.
Across the web (and in CSS frameworks like Bootstrap), REM
is commonly used for everything from padding (example: padding: 2rem;
) to border-radius (example: border-radius: 1rem;
).
Ok, fine, that's reasonable. But why isn't there also a global unit which includes a line-height
modifier? Assuming you're using a typical grid that's based on typography, your type scaling PLUS your type leading is your true baseline, and thus it seems like a FAR more important unit than just plain REM
.
For example, say your REM
is set to 16px, and your body text line-height
is 1.6
.:
body {
font-size: 16px;
line-height: 1.6;
}
This is a relatively common configuration. So why is REM
(which will typically be interpreted as 16px
in this example) used almost everywhere and not a unit that represents your actual grid baseline (which will typically be 25.6px
or 16px * 1.6)?
In other words, why is this standard practice
my-padding: {
padding: 2rem; // typically will be 32px;
}
but not this
my-padding: {
padding: 2rlh; // typically will be 51.2px;
}
(I realize that rlh
, or root line height
, doesn't exist in CSS. My question is why doesn't it exist?).
REM
for line height.line-height: 2rem;
thenpadding: 4rem;
is the same as doingpadding: 2rlh;