Skip to content

Instantly share code, notes, and snippets.

View hihayk's full-sized avatar

Hayk An hihayk

View GitHub Profile
@hihayk
hihayk / dynamic-line-height.css
Created July 7, 2020 17:05
Dynamically decrease line-height as the font-size grows.
:root {
--lineHeightFixedAmount: 0.25rem;
--lineHeightRelativeAmount: 1em;
--sizesIncrement: 1.4;
--fontSize-0: 1rem;
--fontSize-1: calc(var(--fontSize-0) * var(--sizesIncrement));
--fontSize-2: calc(var(--fontSize-1) * var(--sizesIncrement));
--globalLineHeight: calc(var(--lineHeightFixedAmount) + var(--lineHeightRelativeAmount));