2 ms·
Yeah, you can calculate the vertical rhythm, but it can be a bit of pain if you can't rely on CSS4 vars or preprocessing (SASS/LESS/PostCSS and such). Still, n
by rpastuszak 7y ago
Yeah, you can calculate the vertical rhythm, but it can be a bit of pain if you can't rely on CSS4 vars or preprocessing (SASS/LESS/PostCSS and such).
Still, nowadays this is much easier than even 3-4 years ago.
/* _variables.css */
--font-size: 12px;
--ru: 1.5;
/* _typography.css */
p {
font-size: 2rem;
line-height: calc(var(--ru) * 2rem);
margin: calc(var(--ru) * 1rem) 0;
&.small {
font-size: 1.5rem;
line-height: calc(var(--ru) * 1rem);
}
}
- erwinh 7y agonice! thanks for sharing :)