Preskoči na glavni sadržaj
← 🎨 CSS as a design system·Modul B4 · Lekcija 7
ZadatakBuild a modular type scale with --scale: 1.25 on :root. Define --text-sm, --text-base, --text-lg, --text-xl, --text-2xl, --text-3xl as multiplications. Apply --text-3xl to h1, --text-2xl to h2, --text-xl to h3, --text-base to body.

Modularno mjerilo: tipografija koja se čini dizajniranom

100 XP7 min
Teorija

Pick a ratio, multiply your way up

body  = 1rem
h6    = 1rem × 1.25^1 = 1.25rem
h5    = 1rem × 1.25^2 = 1.563rem
h4    = 1rem × 1.25^3 = 1.953rem
h3    = 1rem × 1.25^4 = 2.441rem
h2    = 1rem × 1.25^5 = 3.052rem
h1    = 1rem × 1.25^6 = 3.815rem

Each step is 1.25× the previous — the "Major Third" scale. Headings feel related instead of arbitrary.

Common scales

RatioNameFeel
1.125Major SecondSubtle, dense (good for editorial)
1.25Major ThirdVersatile default
1.333Perfect FourthBold, dramatic
1.5Perfect FifthBig jumps, headlines pop
1.618GoldenClassical

Pick ONE for your project. Stick with it. Suddenly your headings look "designed."

With custom properties

:root {
  --scale: 1.25;
  --text-base: 1rem;
  --text-sm: calc(1rem / var(--scale));         /* 0.8rem */
  --text-lg: calc(1rem * var(--scale));         /* 1.25rem */
  --text-xl: calc(var(--text-lg) * var(--scale));   /* 1.563rem */
  --text-2xl: calc(var(--text-xl) * var(--scale));  /* 1.953rem */
}

h6 { font-size: var(--text-lg); }
h5 { font-size: var(--text-xl); }
h4 { font-size: var(--text-2xl); }

Tailwind's text-sm/-base/-lg/-xl/-2xl is exactly this — a 1.25 modular scale baked in.

Sizes that aren't on the scale

If you need a size between two scale steps for one specific component (a hero subtitle), pick the closer one rather than introducing a new value. Discipline matters more than perfection.

🔒

Registriraj se i počni kodirati

Teorija je otvorena svima. Editor, pregled uživo i provjera otključavaju se s 7-dnevnim besplatnim probnim periodom — potrebna kartica, otkaži kad god.

Registracija — besplatan probni period →

Prvih 10 lekcija u svakom smjeru je besplatno. Bez kartice.

← PrethodnaSljedeća lekcija →

Jedan Python ili web savjet dnevno — emailom

Kratko, ručno pisano, bez spama. Odjavi se jednim klikom.