Golden ratio typography font size and text

For the websites I produce I always use the GoldenRatio as the base of my typography and text. See here how I calculate and define my font sizes in CSS.

Golden Ratio increments

2,618
2,058
1,618 (=golden ratio)
1,272
1.12784
1 (base)
0,88665 (=1/1.12784)
0,786163522 (=1/1.272)
0,697 (0,88665×0,786163522)
0,618 (0,88665×0,697) (=golden ratio)

1.1272 = 1,272 –
1,2722 = 1,618 –
1,6182 = 2,058 –
2,0582 = 2,618

1 (base)
0,8862
0,7862

Golden Ratio and pixels

Definitiongolden ratiopixelspixelspixelspixelspixelspixels
8 | XXX-La2,61834,03436,65241,88847,12452,3657,596
7 | XX-La2,05826,75428,81232,92837,04441,1645,276
6 | X-La1,61821,03422,65225,88829,12432,3635,596
5 | Lar1,27216,53617,80820,35222,89625,4427,984
4 | Med1,12714,65115,77818,03220,28622,5424,794
3 | Reg (base)1131416182022
2 | Sma0,88611,51812,40414,17615,94817,7219,492
1 | X-Sm0,78610,21811,00412,57614,14815,7217,292
9,744
  • = 1.619 (golden ratio) x N (normal/regular font size

Create root in CSS with Golden Ratio pixel size

In this example 1280 is the max width above which the font-size will not get higher.

--global-font-size-3: clamp(14px, calc(18 / 1280 * 100vw), 18px);


The basic font (global-font-size-3) will never be smaller than 14px on small screens.
The basic font (global-font-size-3) will grow to 18px at 1280px screen.
Above 1280px screens it will stay at 18px.

Creating the whole root for CSS

:root {
--global-font-size-8: clamp(36.66px, calc(47.12 / 1280 * 100vw), 47.12px);
--global-font-size-7: clamp(28.81px, calc(37.05 / 1280 * 100vw), 37.05px);
--global-font-size-6: clamp(22.65px, calc(29.15 / 1280 * 100vw), 29.15px);
--global-font-size-5: clamp(17.8px, calc(22.9 / 1280 * 100vw), 22.9px);
--global-font-size-4: clamp(15.8px, calc(20.29 / 1280 * 100vw), 20.29px);
--global-font-size-3: clamp(14px, calc(18 / 1280 * 100vw), 18px);
--global-font-size-2: clamp(12.4, calc(22.9 / 1280 * 100vw), 15.95px);
--global-font-size-1: clamp(11px, calc(18 / 1280 * 100vw), 14.15px);
}

Create font sizes of headings and paragraph

h1, .h1 {font-size: var(--global-font-size-8);}
h2, .h2 {font-size: var(--global-font-size-6);}
h3, .h3 {font-size: var(--global-font-size-4);}
h4, .h4 {font-size: var(--global-font-size-3);}
p {font-size: var(--global-font-size-3);}
p.klein {font-size: var(--global-font-size-2);}
p.mini {font-size: var(--global-font-size-1);}

80 em x 16px = 1280px

1280/18=

:root {
--global-h1-size: clamp(
3em,
calc(9 / 80 * 100vw),
9em
);
}h1,
.h1 {
font-size: var(--global-h1-size);
}

Links:

https://www.30secondsofcode.org/css/s/fluid-typography

https://medium.com/@wayanwina189/ui-typography-guidelines-ios-android-and-website-font-size-guideline-part-2-abcee14df8cb

illustration
Scroll to Top