Volver a profesional.alekssanchez.comBack to profesional.alekssanchez.com

Filosofía de diseño · La escala

Mi escala de tamaños, construida como una escala musical

En lugar de multiplicar siempre por la misma razón, cada tamaño sube con el intervalo real entre una nota y la siguiente. Una sola escala para el texto, los espacios, los controles, las tarjetas y los bloques grandes.

  • ≈ 8 min en visual
  • 6 partes
  • 57 tamaños
  • ≈ 20 min el texto completo
  1. I4 px
  2. II× 9/8
  3. III× 10/9
  4. IV× 16/15
  5. V× 9/8
  6. VI× 10/9
  7. VII× 9/8
× 16/15 hasta la octava: el doble exacto, y vuelta a empezar

Design philosophy · The scale

My size scale, built like a musical scale

Instead of always multiplying by the same ratio, each size steps up by the real interval between one note and the next. A single scale for text, spacing, controls, cards and large blocks.

  • ≈ 8 min visual read
  • 6 parts
  • 57 sizes
  • ≈ 15 min full text
  1. I4 px
  2. II× 9/8
  3. III× 10/9
  4. IV× 16/15
  5. V× 9/8
  6. VI× 10/9
  7. VII× 9/8
× 16/15 to the octave: exactly double, and start again

Aleks SánchezDiseñador de producto · Desarrollador web · Product Owner (PSPO I)Product Designer · Web Developer · Product Owner (PSPO I)

ÍndiceContents
  1. Antes de empezar
    1. Propósito
    2. Cómo leer este documento
  2. ILa idea
    1. 1Multiplicar siempre por lo mismo
    2. 2Lo que hace la música
  3. IILa música
    1. 3Las razones de cada grado
    2. 4Por qué afinación justa
  4. IIILa escala
    1. 5Los tamaños con base 4 px
    2. 6Cómo se nombra cada tamaño
    3. 7Píxeles y rem
    4. 8El redondeo
  5. IVPara todo
    1. 9Texto e interlineado
    2. 10Espacios, radios, iconos y controles
    3. 11Tarjetas y bloques grandes
    4. 12Tamaños fluidos con clamp()
    5. 13Mayor o menor
  6. VAntes y después
    1. 14Tres formas de elegir tamaños
    2. 15Lo que cambia
  7. VIEl generador
    1. 16Cómo usarlo
    2. 17Glosario
  1. Before you start
    1. Purpose
    2. How to read this document
  2. IThe idea
    1. 1Always multiplying by the same
    2. 2What music does
  3. IIThe music
    1. 3The ratio of each degree
    2. 4Why just intonation
  4. IIIThe scale
    1. 5The sizes with a 4 px base
    2. 6How each size is named
    3. 7Pixels and rem
    4. 8Rounding
  5. IVFor everything
    1. 9Text and line height
    2. 10Spacing, radii, icons and controls
    3. 11Cards and large blocks
    4. 12Fluid sizes with clamp()
    5. 13Major or minor
  6. VBefore and after
    1. 14Three ways to choose sizes
    2. 15What changes
  7. VIThe generator
    1. 16How to use it
    2. 17Glossary

Antes de empezar

Una sola escala para todos los tamaños, de 4 a más de 1.000 píxeles, construida con los intervalos reales de la música.

16I18II20III21,33IV24V26,67VI30VII32I TTSTTTS

En vídeo

De las escalas tipográficas de siempre a mi escala musical, con su sonido.

La idea en tres frases

Siete saltos, no unoCada tamaño sube con el intervalo real entre dos notas.
La octava doblaAl séptimo salto, el doble exacto, y vuelta a empezar.
Para todoTexto, espacios, controles, tarjetas y bloques, en px y rem.

En cifras

57tamaños de 4 a 1.024 px
7saltos distintos por octava
1sola escala para todo
Leer en detalle2 secciones: Propósito · Cómo leer este documento

Propósito#

He creado una escala de tamaños propia y es una de las bases de cómo diseño. La uso para todos los tamaños de una interfaz, no solo para la tipografía: el texto y su interlineado, los espacios, los radios, los iconos, la altura de los controles, las tarjetas y los bloques grandes de una página salen de la misma escala, desde 4 hasta más de 1.000 píxeles. Y como las pantallas cambian de tamaño, la escala también marca los mínimos y los máximos de los tamaños fluidos.

La idea parte de la música. Las escalas tipográficas habituales multiplican siempre por la misma razón, como 1,5 o 1,333. Esas dos razones vienen de dos intervalos musicales: la quinta justa (3:2) y la cuarta justa (4:3). Mi escala no se queda con un solo intervalo. Recorre los siete grados de la escala mayor o de la menor, y cada tamaño sube al siguiente con la distancia real que hay entre esas dos notas. Al llegar a la octava, el tamaño se ha duplicado y el ciclo vuelve a empezar.

Este documento explica de dónde salen las razones, cómo se construye la escala, cómo se nombra cada tamaño, cómo se reparte por la interfaz y qué cambia frente a las formas habituales de elegir tamaños. Al final hay un generador para calcularla con otra base, oírla y copiar las variables.

Cómo leer este documento#

ParteSeccionesPara quién
I. La idea§1 Multiplicar siempre por lo mismo · §2 Lo que hace la músicaCualquiera, en cinco minutos
II. La música§3 Las razones de cada grado · §4 Por qué afinación justaQuien quiera entender los números
III. La escala§5 Los tamaños con base 4 px · §6 Cómo se nombra cada tamaño · §7 Píxeles y rem · §8 El redondeoDiseño y desarrollo
IV. Para todo§9 Texto e interlineado · §10 Espacios, radios, iconos y controles · §11 Tarjetas y bloques grandes · §12 Tamaños fluidos con clamp() · §13 Mayor o menorQuien la vaya a aplicar
V. Antes y después§14 Tres formas de elegir tamaños · §15 Lo que cambiaQuien compare sistemas de diseño
VI. El generador§16 Cómo usarlo · §17 GlosarioTodos

Parte ILa idea

Multiplicar siempre por lo mismo da un solo ritmo. La música sube con siete saltos distintos y vuelve exacta al doble.

×1,5 · 14×1,333 · 20Musical · 57 416642561.024

Entre 4 y 1.024 px

481632641282565121.024 ×1,5 · la quinta · 14 tamaños×1,333 · la cuarta · 20 tamañosEscala musical · mayor · 57 tamaños
Escala logarítmica de 4 a 1.024 px. Las líneas verticales son las octavas: la escala musical siempre vuelve a ellas.

Los primeros ocho pasos

×1,5 desde 446913,520,2530,3845,5668,34
×1,333 desde 445,337,119,4812,6416,8622,4729,97
Musical desde 444,555,3366,677,58

La quinta (×1,5) y la cuarta (×1,333) no desaparecen: son los grados V y IV de la escala musical.

Leer en detalle2 secciones: Multiplicar siempre por lo mismo · Lo que hace la música

1Multiplicar siempre por lo mismo#

1.1 Las escalas modulares#

Una escala modular parte de un tamaño base y multiplica por una razón fija para obtener el siguiente: con base 16 y razón 1,5 salen 16, 24, 36, 54… Las razones más conocidas tienen nombre musical porque vienen de los intervalos: 1,5 es la quinta justa (3:2) y 1,333 es la cuarta justa (4:3). También se usan 1,25 (la tercera mayor, 5:4) y 1,2 (la tercera menor, 6:5).

1.2 Dónde se quedan cortas#

Con una sola razón, la escala tiene un único ritmo. Eso trae tres problemas:

  • Pocos tamaños o tamaños demasiado parecidos. Entre 4 y 64 px, multiplicar por 1,5 da solo siete tamaños: 4, 6, 9, 13,5, 20,25, 30,4 y 45,6. Por 1,333 salen diez: 4; 5,3; 7,1; 9,5; 12,6; 16,9; 22,5; 30; 40 y 53,3. Cuanto mayor es la razón, menos tamaños hay; cuanto menor, más se parecen entre sí.
  • Se sale de la rejilla A partir del tercer o cuarto paso, los tamaños dejan de ser números redondos y ya no caen en los múltiplos de 4 y de 8 con los que se maquetan los espacios. Hace falta una segunda escala para el espaciado, y otra para las anchuras.

  • Nunca vuelve al doble Ninguna razón fija sencilla cae exactamente en la octava: con 1,125, seis pasos dan 2,03 y no 2. Las únicas que lo hacen son raíces de 2, como 1,1225, y dan decimales en todos los pasos.

2Lo que hace la música#

2.1 La octava y los siete grados#

En música, una nota y su octava suenan como «la misma nota», solo que más aguda, porque la frecuencia de la octava es exactamente el doble. Entre las dos, la escala mayor y la menor colocan siete grados, del I al VII. Cada grado tiene una razón con la nota base: la quinta, por ejemplo, vibra 3/2 veces más rápido.

2.2 Saltos desiguales#

Los siete saltos entre un grado y el siguiente no son iguales: hay tonos, más grandes, y semitonos, más pequeños. Esa irregularidad da carácter a cada escala, y es lo que aprovecha mi sistema:

  • La escala avanza con pasos de distinto tamaño. Hay tamaños cercanos entre sí donde hace falta afinar y saltos más amplios donde hace falta contraste.
  • Al completar los siete saltos, el tamaño se ha duplicado exactamente, y el ciclo vuelve a empezar por el grado I. Con base 4, las octavas caen en 4, 8, 16, 32, 64, 128, 256, 512 y 1.024: la rejilla de 4 px queda dentro de la escala, de los textos más pequeños a los bloques más grandes.
  • La quinta (×1,5) y la cuarta (×1,333) de las escalas modulares siguen ahí: son dos de los siete grados. Mi escala no las descarta, las completa.

Parte IILa música

Tono, tono, semitono… Cada grado tiene una razón sencilla con la base: 9/8, 5/4, 4/3, 3/2.

1I9/8II5/4III4/3IV3/2V5/3VI15/8VII2I Do mayor: solo teclas blancas

Los siete saltos de una octava

Mayor
×9/8×10/9×16/15×9/8×10/9×9/8×16/15
Menor
×9/8×16/15×10/9×9/8×16/15×9/8×10/9

tono mayor ×9/8tono menor ×10/9semitono ×16/15

Una octava de 16 a 32 px. 16 px suena como el do central.

Afinación justa frente a temperada

Quinta justa 3/2 → 24temperada 23,97
Tercera mayor justa 5/4 → 20temperada 20,16
Sexta mayor justa 5/3 → 26,67temperada 26,91

Con base 16: la afinación justa da números redondos; la del piano, decimales.

Leer en detalle2 secciones: Las razones de cada grado · Por qué afinación justa

3Las razones de cada grado#

3.1 Escala mayor#

GradoNombreRazón con la baseSalto desde el grado anterior
ITónica1—
IISupertónica9/8 = 1,125× 9/8 (tono mayor)
IIIMediante5/4 = 1,25× 10/9 (tono menor)
IVSubdominante4/3 = 1,333× 16/15 (semitono)
VDominante3/2 = 1,5× 9/8 (tono mayor)
VISuperdominante5/3 = 1,667× 10/9 (tono menor)
VIISensible15/8 = 1,875× 9/8 (tono mayor)
IOctava2× 16/15 (semitono)

El patrón de la mayor es tono, tono, semitono, tono, tono, tono, semitono.

3.2 Escala menor#

Es la menor natural. Comparte con la mayor la tónica, la segunda, la cuarta y la quinta, y baja la tercera, la sexta y la séptima.

GradoNombreRazón con la baseSalto desde el grado anterior
ITónica1—
IISupertónica9/8 = 1,125× 9/8 (tono mayor)
IIIMediante6/5 = 1,2× 16/15 (semitono)
IVSubdominante4/3 = 1,333× 10/9 (tono menor)
VDominante3/2 = 1,5× 9/8 (tono mayor)
VISuperdominante8/5 = 1,6× 16/15 (semitono)
VIISubtónica9/5 = 1,8× 9/8 (tono mayor)
IOctava2× 10/9 (tono menor)

El patrón de la menor es tono, semitono, tono, tono, semitono, tono, tono.

4Por qué afinación justa#

Hay dos formas de fijar las razones. La afinación justa usa fracciones de números enteros pequeños (3/2, 5/4…), las que salen de la física del sonido. La afinación temperada, la del piano moderno, divide la octava en doce semitonos iguales de 2^(1/12) ≈ 1,0595, y las razones dejan de ser fracciones: la quinta temperada es 1,4983 y la tercera mayor, 1,2599.

Para una escala de tamaños, la justa es mejor. Con fracciones sencillas, una base de 4 da números enteros o con un decimal corto: con base 16, la quinta es 24 y no 23,97, y la tercera mayor es 20 y no 20,16. La temperada solo tiene sentido si se quiere llevar la escala a cualquier tonalidad, algo que una interfaz no necesita.

Parte IIILa escala

Base 4 px, ocho octavas y 57 tamaños, cada uno con un nombre que dice dónde está: 16-5 son 24 px, 1,5 rem.

A1616-1A1816-2A2016-3A21,316-4A2416-5A26,716-6A3016-7A3232-1

Ocho octavas, 57 tamaños

OctavaIIIIIIIVVVIVII
440,25 rem4,50,2813 rem50,3125 rem5,330,3333 rem60,375 rem6,670,4167 rem7,50,4688 rem
880,5 rem90,5625 rem100,625 rem10,670,6667 rem120,75 rem13,330,8333 rem150,9375 rem
16161 rem181,125 rem201,25 rem21,331,3333 rem241,5 rem26,671,6667 rem301,875 rem
32322 rem362,25 rem402,5 rem42,672,6667 rem483 rem53,333,3333 rem603,75 rem
64644 rem724,5 rem805 rem85,335,3333 rem966 rem106,676,6667 rem1207,5 rem
1281288 rem1449 rem16010 rem170,6710,6667 rem19212 rem213,3313,3333 rem24015 rem
25625616 rem28818 rem32020 rem341,3321,3333 rem38424 rem426,6726,6667 rem48030 rem
51251232 rem57636 rem64040 rem682,6742,6667 rem76848 rem853,3353,3333 rem96060 rem
1.0241.02464 rem
OctavaIIIIIIIVVVIVII
440,25 rem4,50,2813 rem4,80,3 rem5,330,3333 rem60,375 rem6,40,4 rem7,20,45 rem
880,5 rem90,5625 rem9,60,6 rem10,670,6667 rem120,75 rem12,80,8 rem14,40,9 rem
16161 rem181,125 rem19,21,2 rem21,331,3333 rem241,5 rem25,61,6 rem28,81,8 rem
32322 rem362,25 rem38,42,4 rem42,672,6667 rem483 rem51,23,2 rem57,63,6 rem
64644 rem724,5 rem76,84,8 rem85,335,3333 rem966 rem102,46,4 rem115,27,2 rem
1281288 rem1449 rem153,69,6 rem170,6710,6667 rem19212 rem204,812,8 rem230,414,4 rem
25625616 rem28818 rem307,219,2 rem341,3321,3333 rem38424 rem409,625,6 rem460,828,8 rem
51251232 rem57636 rem614,438,4 rem682,6742,6667 rem76848 rem819,251,2 rem921,657,6 rem
1.0241.02464 rem

número enterogrados I y V, la serie más estable

Cómo se lee un nombre

16-5

16 la tónica de la octava: el tamaño del grado I

5 el grado: la quinta, ×3/2

= 24 px · 1,5 rem · --escala-16-5: 1.5rem;

Leer en detalle4 secciones: Los tamaños con base 4 px · Cómo se nombra cada tamaño · Píxeles y rem · El redondeo

5Los tamaños con base 4 px#

5.1 Mayor#

OctavaIIIIIIIVVVIVII
444,555,3366,677,5
8891010,671213,3315
1616182021,332426,6730
3232364042,674853,3360
6464728085,3396106,67120
128128144160170,67192213,33240
256256288320341,33384426,67480
512512576640682,67768853,33960

5.2 Menor#

OctavaIIIIIIIVVVIVII
444,54,85,3366,47,2
8899,610,671212,814,4
16161819,221,332425,628,8
32323638,442,674851,257,6
64647276,885,3396102,4115,2
128128144153,6170,67192204,8230,4
256256288307,2341,33384409,6460,8
512512576614,4682,67768819,2921,6

Entre 4 y 1.024 px, cada escala da 57 tamaños: siete por octava en ocho octavas, más el 1.024. En la mayor, 39 son números enteros; en la menor, 24. En el mismo tramo, multiplicar por 1,5 da 14 tamaños y por 1,333, 20.

6Cómo se nombra cada tamaño#

Cada tamaño se nombra con la tónica de su octava y su grado: 16-5 es la quinta de la octava de 16, es decir, 24 px. Como variable CSS: --escala-16-5: 1.5rem, que son 24 px (ver §7).

El nombre dice dónde está cada tamaño, no solo cuánto mide. El mismo grado en dos octavas seguidas es exactamente el doble: 16-5 mide 24 y 32-5, 48. Y los grados I y V de cada octava forman la serie más estable de la escala: 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128…

7Píxeles y rem#

Cada tamaño se puede escribir en píxeles o en rem. Un rem es el tamaño de letra de la raíz del documento, 16 px por defecto, y escribir en rem hace que toda la interfaz respete el tamaño de letra que cada persona ha elegido en su navegador.

Con base 4, la escala encaja de forma natural con el rem: la tónica de la octava de 16 es exactamente 1 rem, y todos los demás tamaños son una fracción sencilla de él.

NombrePíxelesrem
4-140,25
8-180,5
8-5120,75
16-1161
16-2181,125
16-3201,25
16-5241,5
16-7301,875
32-1322
32-5483
64-1644
256-538424
512-576848

En el diseño se habla en píxeles, que se leen mejor, y en el código las variables se escriben en rem, con su valor en píxeles en un comentario: --escala-16-5: 1.5rem; /* 24px */.

8El redondeo#

Las razones exactas dan algunos decimales: tercios en los grados IV y VI de la mayor (5,33; 10,67; 21,33…) y décimas en la menor (4,8; 19,2; 25,6…). En los tamaños grandes pesan menos: 853,33 px redondeado a 853 se desvía menos de un 0,04 %. Se pueden usar de dos formas:

  • Exactos Los navegadores dibujan las letras con precisión de subpíxel, así que un texto de 21,33 px se ve como lo que es.

  • Redondeados En bordes, espacios y alturas, medio píxel puede verse como un borde borroso, y es mejor redondear al píxel o al medio píxel.

El generador calcula las dos versiones.

Parte IVPara todo

El texto, los espacios, los controles, las tarjetas y los bloques salen de la misma escala. Y los clamp() empiezan y terminan en una nota.

384 · 256-5 192 · 128-5 40 · 32-3 24 · 16-5 título 24texto 16/24

El texto, con su interlineado

Título48/60 px · 3/3,75 rem32-5 / 32-7

Diseño con una escala

Título de sección30/36 px · 1,875/2,25 rem16-7 / 32-2

Cada tamaño tiene su nota

Entradilla20/30 px · 1,25/1,875 rem16-3 / 16-7

La escala marca el ritmo de toda la página.

Texto16/24 px · 1/1,5 rem16-1 / 16-5

El interlineado del texto es su quinta: 16 sobre 24. Los espacios, los radios y los controles salen de la misma serie.

Texto pequeño12/18 px · 0,75/1,125 rem8-5 / 16-2

Pie de foto, etiquetas y notas: 12 sobre 18.

Fluido con clamp()

Proporciones en cualquier pantalla

Cada tamaño empieza y termina en una nota de la escala.

espacio entre secciones
Título40 px32-1 → 32-5 · quintaclamp(2rem, 1.5714rem + 1.7857vw, 3rem)
Título de sección27 px16-5 → 16-7 · tercera mayorclamp(1.5rem, 1.3393rem + 0.6696vw, 1.875rem)
Texto17 px16-1 → 16-2 · un tonoclamp(1rem, 0.9464rem + 0.2232vw, 1.125rem)
Espacio entre secciones72 px32-5 → 64-5 · octavaclamp(3rem, 1.7143rem + 5.3571vw, 6rem)

Uso clamp() así en todo mi proceso, y es una de las razones por las que mi diseño es de calidad: los extremos son siempre notas de la escala y las proporciones se mantienen en cualquier pantalla.

Tarjetas y bloques grandes

Contenedor 960 · 512-7 288 · 256-2288 · 256-2288 · 256-2 4848 384 × 1922:1 · octava 384 × 2563:2 · quinta
3 × 288 + 2 × 48 = 960: las piezas grandes encajan porque son razones sencillas entre sí.

Mayor o menor (octava de 16)

III
mayor 20menor 19,2
VI
mayor 26,67menor 25,6
VII
mayor 30menor 28,8

Comparten I, II, IV y V. La menor baja la tercera, la sexta y la séptima.

Leer en detalle5 secciones: Texto e interlineado · Espacios, radios, iconos y controles · Tarjetas y bloques grandes · Tamaños fluidos con clamp() · Mayor o menor

9Texto e interlineado#

La escala es una sola para todo, así que el texto y su interlineado también salen de ella. Un ejemplo de reparto con la escala mayor y base 4:

UsoTamañoNombreInterlineadoNombre
Texto pequeño12 px · 0,75 rem8-518 px · 1,125 rem16-2
Texto16 px · 1 rem16-124 px · 1,5 rem16-5
Entradilla20 px · 1,25 rem16-330 px · 1,875 rem16-7
Título de sección30 px · 1,875 rem16-736 px · 2,25 rem32-2
Título48 px · 3 rem32-560 px · 3,75 rem32-7

En el texto corrido, el interlineado es la quinta de su tamaño: 12 → 18, 16 → 24, 20 → 30. En los títulos el intervalo es más corto, una tercera (30 → 36 es ×6/5 y 48 → 60 es ×5/4), porque las líneas grandes necesitan menos aire entre sí.

10Espacios, radios, iconos y controles#

Todo tamaño de la interfaz sale de la escala. Un ejemplo de reparto con la mayor y base 4:

UsoTamaños
Espacios4, 8, 12, 16, 24, 32, 48 y 64, y para afinar, 6, 10, 20 y 40
Radios4, 6, 8, 12 y 16
Iconos16, 20, 24 y 32
Alturas de control32, 36, 40 y 48

Los espacios principales son las tónicas y las dominantes (grados I y V): la rejilla de 4 y 8 px de siempre. Los demás grados dan los pasos intermedios cuando un espacio necesita afinarse, sin inventar un número que no esté en la escala.

11Tarjetas y bloques grandes#

La escala sigue subiendo con el mismo patrón por encima de los 100 píxeles, así que también da las anchuras y las alturas de las piezas grandes. Un ejemplo de reparto:

PiezaTamañoNombre
Imagen de una tarjeta192 px · 12 rem de alto128-5
Tarjeta384 px · 24 rem de ancho256-5
Columna de lectura640 px · 40 rem de ancho512-3
Bloque de contenido768 px · 48 rem de ancho512-5
Contenedor de página960 px · 60 rem o 1.024 px · 64 rem de ancho512-7 o 1024-1

Como cada tamaño es una razón sencilla de los demás, las piezas encajan entre sí: tres columnas de 288 (256-2) con dos huecos de 48 llenan exactamente los 960 del contenedor. Y las proporciones también son intervalos: una tarjeta de 384 × 192 es una octava (2:1) y una imagen de 384 × 256, una quinta (3:2).

12Tamaños fluidos con clamp()#

12.1 La escala marca los extremos#

Un tamaño fijo vale para una pantalla; en una web, el mismo título tiene que verse bien en un móvil y en un monitor. Para eso uso clamp() de CSS, que hace crecer un tamaño con el ancho de la pantalla entre un mínimo y un máximo: clamp(mínimo, preferido, máximo).

La regla es que el mínimo y el máximo son siempre dos tamaños de la escala. Lo que cambia con la pantalla es el recorrido entre ellos, nunca los extremos. Y los anchos de pantalla entre los que crece también salen de la escala: de 384 px (256-5) a 1.280 px (1024-3).

Uso clamp() así en todo mi proceso, y es una de las razones por las que mi diseño es de calidad: mantiene sus proporciones en cualquier pantalla. En un móvil y en un monitor, cada tamaño empieza y termina en una nota de la escala, y las relaciones entre el texto, los espacios y las piezas se conservan mientras la pantalla cambia.

12.2 Ejemplos#

UsoMínimoMáximoIntervaloCSS
Texto16 px · 1 rem (16-1)18 px · 1,125 rem (16-2)un tonoclamp(1rem, 0.9464rem + 0.2232vw, 1.125rem)
Entradilla20 px · 1,25 rem (16-3)24 px · 1,5 rem (16-5)tercera menorclamp(1.25rem, 1.1429rem + 0.4464vw, 1.5rem)
Título de sección24 px · 1,5 rem (16-5)30 px · 1,875 rem (16-7)tercera mayorclamp(1.5rem, 1.3393rem + 0.6696vw, 1.875rem)
Título32 px · 2 rem (32-1)48 px · 3 rem (32-5)quintaclamp(2rem, 1.5714rem + 1.7857vw, 3rem)
Margen lateral16 px · 1 rem (16-1)32 px · 2 rem (32-1)octavaclamp(1rem, 0.5714rem + 1.7857vw, 2rem)
Espacio entre secciones48 px · 3 rem (32-5)96 px · 6 rem (64-5)octavaclamp(3rem, 1.7143rem + 5.3571vw, 6rem)

El salto entre el mínimo y el máximo también es un intervalo, y se elige según cuánto debe crecer cada cosa: el texto corrido apenas cambia (un tono), los títulos crecen una quinta y los espacios grandes, una octava.

12.3 Cómo se calcula#

El valor preferido es una recta que pasa por el mínimo en la pantalla más estrecha y por el máximo en la más ancha. Con un mínimo a, un máximo b y pantallas de 384 a 1.280 px:

  • pendiente = (b − a) ÷ (1.280 − 384), que en CSS se escribe como pendiente × 100 vw;
  • punto de partida = a − pendiente × 384, que se escribe en rem para que respete el tamaño de letra que haya elegido cada persona.

El generador lo calcula solo: se elige cuántos grados sube cada tamaño y exporta todos los clamp().

13Mayor o menor#

Las dos escalas comparten cuatro grados (I, II, IV y V), así que los tamaños más usados (4, 6, 8, 12, 16, 24, 32, 48…) son iguales en las dos. Cambian la tercera, la sexta y la séptima, que en la menor quedan un poco más bajas:

Grado (octava de 16)MayorMenor
III2019,2
VI26,6725,6
VII3028,8

La mayor da más números enteros (39 de 57, frente a 24). La menor acerca la tercera a la segunda y la sexta a la quinta, con saltos más contenidos en los tamaños intermedios. Elegir una u otra cambia el carácter de esos tamaños sin tocar la estructura.

Parte VAntes y después

La misma tarjeta con tres sistemas: a ojo, con dos escalas que no se hablan y con una sola escala musical.

Antes · a ojo Después · escala musical cada raya es un tamaño de la escala

La misma tarjeta, tres sistemas

A ojo · Cada número elegido en su momento. 4 de 11 medidas en la escala

Guía

Una tarjeta de ejemplo

El mismo contenido, con las medidas de cada sistema.

Ver más
  • Ancho370fuera
  • Imagen200fuera
  • Relleno22fuera
  • Radio108-3
  • Antetítulo11fuera
  • Su interlineado1616-1
  • Título22fuera
  • Su interlineado28fuera
  • Texto158-7
  • Su interlineado22fuera
  • Hueco108-3
  • Botón (alto)42fuera
  • Texto del botón14fuera
  • Radio del botón64-5
41664256

Dos escalas · Texto ×1,25 y espacios de 8 en 8. 4 de 10 medidas en la escala

Guía

Una tarjeta de ejemplo

El mismo contenido, con las medidas de cada sistema.

Ver más
  • Ancho360fuera
  • Imagen200fuera
  • Relleno2416-5
  • Radio88-1
  • Antetítulo12,8fuera
  • Su interlineado19,2fuera
  • Título25fuera
  • Su interlineado37,5fuera
  • Texto1616-1
  • Su interlineado2416-5
  • Hueco88-1
  • Botón (alto)4032-3
  • Texto del botón1616-1
  • Radio del botón88-1
41664256

Escala musical · Todo de la misma escala. 9 de 9 medidas en la escala

Guía

Una tarjeta de ejemplo

El mismo contenido, con las medidas de cada sistema.

Ver más
  • Ancho384256-5
  • Imagen192128-5
  • Relleno2416-5
  • Radio1616-1
  • Antetítulo128-5
  • Su interlineado1816-2
  • Título2416-5
  • Su interlineado3016-7
  • Texto1616-1
  • Su interlineado2416-5
  • Hueco88-1
  • Botón (alto)4032-3
  • Texto del botón1616-1
  • Radio del botón88-1
41664256

Lo que cambia

Se decide una vezSe elige un grado y la escala dice cuánto mide.
Un solo idioma16-5 es lo mismo en el diseño y en el código.
Proporciones que se repiten3:2, 5:4 y 2:1 en el texto, los espacios y las piezas.
Crece sin romperseUna pieza nueva no trae números nuevos.
Leer en detalle2 secciones: Tres formas de elegir tamaños · Lo que cambia

14Tres formas de elegir tamaños#

14.1 A ojo#

Es lo más común cuando no hay sistema: cada tamaño se elige en su momento y se ajusta hasta que «queda bien». Una tarjeta típica acaba con un texto de 15, un título de 22, un relleno de 22, un radio de 10, un botón de 42 y una anchura de 370. Cada número tiene sentido por separado, pero no hay ninguna relación entre ellos: nadie puede deducir el siguiente, y cada pantalla nueva añade números distintos.

14.2 Dos escalas que no se hablan#

Es lo que hacen muchos sistemas de diseño: una escala modular para el texto (por ejemplo, ×1,25: 12,8, 16, 20, 25, 31,25…) y una rejilla lineal de 8 en 8 para los espacios (8, 16, 24, 32, 40…). Cada escala es coherente consigo misma, pero no con la otra: un título de 25 con su interlineado de 37,5 no cae en la rejilla, y las anchuras de las piezas grandes quedan fuera de las dos.

14.3 Una sola escala musical#

Con mi escala, el texto, los espacios, los radios, los controles y las anchuras salen de la misma serie. Todos los tamaños son razones sencillas entre sí, y las octavas caen en la rejilla de 4 px. La tarjeta del ejemplo queda con un texto de 16 sobre 24, un título de 24 sobre 30, un relleno de 24, un radio de 16, un botón de 40 y una anchura de 384: todos los números pertenecen a la misma escala.

15Lo que cambia#

  • Se decide una vez No hay que elegir un número cada vez: se elige un grado, y la escala ya dice cuánto mide.

  • Un solo idioma para diseño y desarrollo. 16-5 significa lo mismo en el diseño y en el código, y vale igual para un texto que para un espacio.
  • Las proporciones se repiten. Interlineados, márgenes y anchuras guardan las mismas razones (3:2, 5:4, 2:1) en todos los tamaños de la página, y por eso el conjunto se percibe ordenado aunque nadie sepa por qué.
  • Crece sin romperse Una pieza nueva no trae números nuevos: usa los grados que ya existen. Cambiar la base o pasar de mayor a menor mueve todo a la vez y mantiene las relaciones.

El interactivo de esta parte enseña la misma tarjeta con los tres sistemas y coloca cada medida sobre la escala: con los dos primeros, muchos tamaños caen entre las notas; con la escala musical, todos caen en una.

Parte VIEl generador

Calcula la escala con tu base, escúchala y copia las variables en rem, con sus clamp() si las quieres fluidas.

Mayor ♪ 261,63 Hz

Generador de la escala

Escala

57 tamaños · 39 enteros

EscucharNombreGradoRazónpxremTamaño
4-1I1/140,25
4-2II9/84,50,2813
4-3III5/450,3125
4-4IV4/35,330,3333
4-5V3/260,375
4-6VI5/36,670,4167
4-7VII15/87,50,4688
8-1I1/180,5
8-2II9/890,5625
8-3III5/4100,625
8-4IV4/310,670,6667
8-5V3/2120,75
8-6VI5/313,330,8333
8-7VII15/8150,9375
16-1I1/1161
16-2II9/8181,125
16-3III5/4201,25
16-4IV4/321,331,3333
16-5V3/2241,5
16-6VI5/326,671,6667
16-7VII15/8301,875
32-1I1/1322
32-2II9/8362,25
32-3III5/4402,5
32-4IV4/342,672,6667
32-5V3/2483
32-6VI5/353,333,3333
32-7VII15/8603,75
64-1I1/1644
64-2II9/8724,5
64-3III5/4805
64-4IV4/385,335,3333
64-5V3/2966
64-6VI5/3106,676,6667
64-7VII15/81207,5
128-1I1/11288
128-2II9/81449
128-3III5/416010
128-4IV4/3170,6710,6667
128-5V3/219212
128-6VI5/3213,3313,3333
128-7VII15/824015
256-1I1/125616
256-2II9/828818
256-3III5/432020
256-4IV4/3341,3321,3333
256-5V3/238424
256-6VI5/3426,6726,6667
256-7VII15/848030
512-1I1/151232
512-2II9/857636
512-3III5/464040
512-4IV4/3682,6742,6667
512-5V3/276848
512-6VI5/3853,3353,3333
512-7VII15/896060
1024-1I1/11.02464
:root {
  /* Escala musical · mayor · base 4px · afinación justa */
  --escala-4-1: 0.25rem; /* 4px */
  --escala-4-2: 0.2813rem; /* 4.5px */
  --escala-4-3: 0.3125rem; /* 5px */
  --escala-4-4: 0.3333rem; /* 5.33px */
  --escala-4-5: 0.375rem; /* 6px */
  --escala-4-6: 0.4167rem; /* 6.67px */
  --escala-4-7: 0.4688rem; /* 7.5px */
  --escala-8-1: 0.5rem; /* 8px */
  --escala-8-2: 0.5625rem; /* 9px */
  --escala-8-3: 0.625rem; /* 10px */
  --escala-8-4: 0.6667rem; /* 10.67px */
  --escala-8-5: 0.75rem; /* 12px */
  --escala-8-6: 0.8333rem; /* 13.33px */
  --escala-8-7: 0.9375rem; /* 15px */
  --escala-16-1: 1rem; /* 16px */
  --escala-16-2: 1.125rem; /* 18px */
  --escala-16-3: 1.25rem; /* 20px */
  --escala-16-4: 1.3333rem; /* 21.33px */
  --escala-16-5: 1.5rem; /* 24px */
  --escala-16-6: 1.6667rem; /* 26.67px */
  --escala-16-7: 1.875rem; /* 30px */
  --escala-32-1: 2rem; /* 32px */
  --escala-32-2: 2.25rem; /* 36px */
  --escala-32-3: 2.5rem; /* 40px */
  --escala-32-4: 2.6667rem; /* 42.67px */
  --escala-32-5: 3rem; /* 48px */
  --escala-32-6: 3.3333rem; /* 53.33px */
  --escala-32-7: 3.75rem; /* 60px */
  --escala-64-1: 4rem; /* 64px */
  --escala-64-2: 4.5rem; /* 72px */
  --escala-64-3: 5rem; /* 80px */
  --escala-64-4: 5.3333rem; /* 85.33px */
  --escala-64-5: 6rem; /* 96px */
  --escala-64-6: 6.6667rem; /* 106.67px */
  --escala-64-7: 7.5rem; /* 120px */
  --escala-128-1: 8rem; /* 128px */
  --escala-128-2: 9rem; /* 144px */
  --escala-128-3: 10rem; /* 160px */
  --escala-128-4: 10.6667rem; /* 170.67px */
  --escala-128-5: 12rem; /* 192px */
  --escala-128-6: 13.3333rem; /* 213.33px */
  --escala-128-7: 15rem; /* 240px */
  --escala-256-1: 16rem; /* 256px */
  --escala-256-2: 18rem; /* 288px */
  --escala-256-3: 20rem; /* 320px */
  --escala-256-4: 21.3333rem; /* 341.33px */
  --escala-256-5: 24rem; /* 384px */
  --escala-256-6: 26.6667rem; /* 426.67px */
  --escala-256-7: 30rem; /* 480px */
  --escala-512-1: 32rem; /* 512px */
  --escala-512-2: 36rem; /* 576px */
  --escala-512-3: 40rem; /* 640px */
  --escala-512-4: 42.6667rem; /* 682.67px */
  --escala-512-5: 48rem; /* 768px */
  --escala-512-6: 53.3333rem; /* 853.33px */
  --escala-512-7: 60rem; /* 960px */
  --escala-1024-1: 64rem; /* 1024px */
}
Leer en detalle2 secciones: Cómo usarlo · Glosario

16Cómo usarlo#

El generador de esta parte calcula la escala con cualquier base:

  1. Base: el tamaño de la primera tónica (4 px por defecto).
  2. Escala: mayor o menor.
  3. Rango: hasta qué octava llega.
  4. Redondeo: exacto, al medio píxel o al píxel.
  5. Fluido: si cada tamaño crece con la pantalla y cuántos grados sube (un tono, una tercera, una quinta o una octava), con el ancho de pantalla mínimo y máximo.
  6. Prefijo: el nombre de las variables (escala por defecto).

Cada tamaño se puede oír. La tónica de la tercera octava (16 px con base 4) suena como el do central, a 261,63 Hz, y el resto conserva su razón con ella: lo que suena es la escala que se ve. Los tamaños muy pequeños o muy grandes suenan una o varias octavas más cerca del centro, para que se oigan bien. Debajo están las variables listas para copiar, en CSS (en rem, con los píxeles en un comentario, o con sus clamp() si se ha elegido fluido) o en JSON.

17Glosario#

  • Base: el tamaño de la primera tónica. Todos los demás salen de multiplicarla.
  • Grado: cada una de las siete notas de la escala, del I al VII.
  • Tónica: el grado I, el que da nombre a cada octava.
  • Dominante: el grado V, a 3/2 (×1,5) de la tónica.
  • Subdominante: el grado IV, a 4/3 (×1,333) de la tónica.
  • Octava: el salto que duplica el tamaño (×2).
  • Tono mayor, tono menor y semitono: los tres saltos de la afinación justa: ×9/8, ×10/9 y ×16/15.
  • Afinación justa: razones de números enteros pequeños.
  • Afinación temperada: doce semitonos iguales de 2^(1/12); la del piano moderno.
  • Escala modular: la que multiplica siempre por la misma razón.
  • rem: el tamaño de letra de la raíz del documento (16 px por defecto); la unidad en la que se escriben las variables.
  • clamp(): la función de CSS que hace crecer un tamaño con la pantalla entre un mínimo y un máximo. En esta escala, los dos extremos son grados.
  • Rejilla lineal: la que suma siempre la misma cantidad, como de 8 en 8.

Before you start

A single scale for every size, from 4 to over 1,000 pixels, built from the real intervals of music.

16I18II20III21.33IV24V26.67VI30VII32I TTSTTTS

On video

From the usual type scales to my musical scale, with its sound.

The idea in three sentences

Seven steps, not oneEach size rises by the real interval between two notes.
The octave doublesAfter the seventh step, exactly double, and start again.
For everythingText, spacing, controls, cards and blocks, in px and rem.

In numbers

57sizes from 4 to 1,024 px
7different steps per octave
1single scale for everything
Read in detail2 sections: Purpose · How to read this document

Purpose#

I created my own size scale, and it's one of the foundations of how I design. I use it for every size in an interface, not just typography: text and its line height, spacing, radii, icons, control heights, cards and the large blocks of a page all come from the same scale, from 4 to over 1,000 pixels. And since screens change size, the scale also sets the minimums and maximums of fluid sizes.

The idea comes from music. The usual type scales always multiply by the same ratio, such as 1.5 or 1.333. Those two ratios come from two musical intervals: the perfect fifth (3:2) and the perfect fourth (4:3). My scale doesn't settle for a single interval. It walks through the seven degrees of the major or minor scale, and each size steps up to the next by the real distance between those two notes. When it reaches the octave, the size has doubled and the cycle starts again.

This document explains where the ratios come from, how the scale is built, how each size is named, how it's spread across the interface and what changes compared with the usual ways of choosing sizes. At the end there's a generator to compute it with another base, listen to it and copy the variables.

How to read this document#

PartSectionsWho it's for
I. The idea§1 Always multiplying by the same · §2 What music doesAnyone, in five minutes
II. The music§3 The ratio of each degree · §4 Why just intonationAnyone who wants to understand the numbers
III. The scale§5 The sizes with a 4 px base · §6 How each size is named · §7 Pixels and rem · §8 RoundingDesign and engineering
IV. For everything§9 Text and line height · §10 Spacing, radii, icons and controls · §11 Cards and large blocks · §12 Fluid sizes with clamp() · §13 Major or minorWhoever will apply it
V. Before and after§14 Three ways to choose sizes · §15 What changesAnyone comparing design systems
VI. The generator§16 How to use it · §17 GlossaryEveryone

Part IThe idea

Always multiplying by the same gives a single rhythm. Music rises in seven different steps and lands exactly on double.

×1.5 · 14×1.333 · 20Musical · 57 416642561,024

Between 4 and 1,024 px

481632641282565121,024 ×1.5 · the fifth · 14 sizes×1.333 · the fourth · 20 sizesMusical scale · major · 57 sizes
Log scale from 4 to 1,024 px. The vertical lines are the octaves: the musical scale always comes back to them.

The first eight steps

×1.5 from 446913.520.2530.3845.5668.34
×1.333 from 445.337.119.4812.6416.8622.4729.97
Musical from 444.555.3366.677.58

The fifth (×1.5) and the fourth (×1.333) don't disappear: they are degrees V and IV of the musical scale.

Read in detail2 sections: Always multiplying by the same · What music does

1Always multiplying by the same#

1.1 Modular scales#

A modular scale starts from a base size and multiplies by a fixed ratio to get the next one: with a base of 16 and a ratio of 1.5 you get 16, 24, 36, 54… The best-known ratios have musical names because they come from intervals: 1.5 is the perfect fifth (3:2) and 1.333 is the perfect fourth (4:3). 1.25 (the major third, 5:4) and 1.2 (the minor third, 6:5) are also common.

1.2 Where they fall short#

With a single ratio, the scale has a single rhythm. That brings three problems:

  • Too few sizes, or sizes too alike. Between 4 and 64 px, multiplying by 1.5 gives only seven sizes: 4, 6, 9, 13.5, 20.25, 30.4 and 45.6. Multiplying by 1.333 gives ten: 4; 5.3; 7.1; 9.5; 12.6; 16.9; 22.5; 30; 40 and 53.3. The larger the ratio, the fewer sizes; the smaller, the more alike they get.
  • It leaves the grid From the third or fourth step on, sizes stop being round numbers and no longer land on the multiples of 4 and 8 used to lay out spacing. You need a second scale for spacing, and another for widths.

  • It never gets back to double. No simple fixed ratio lands exactly on the octave: with 1.125, six steps give 2.03, not 2. The only ones that do are roots of 2, such as 1.1225, and they give decimals at every step.

2What music does#

2.1 The octave and the seven degrees#

In music, a note and its octave sound like "the same note", only higher, because the octave's frequency is exactly double. Between the two, the major and minor scales place seven degrees, from I to VII. Each degree has a ratio to the base note: the fifth, for example, vibrates 3/2 times faster.

2.2 Uneven steps#

The seven steps between one degree and the next are not equal: there are whole tones, larger, and semitones, smaller. That irregularity gives each scale its character, and it's what my system builds on:

  • The scale moves in steps of different sizes. There are sizes close to each other where fine-tuning is needed and wider jumps where contrast is needed.
  • After the seven steps, the size has exactly doubled, and the cycle starts again from degree I. With a base of 4, the octaves land on 4, 8, 16, 32, 64, 128, 256, 512 and 1,024: the 4 px grid sits inside the scale, from the smallest text to the largest blocks.
  • The fifth (×1.5) and the fourth (×1.333) of modular scales are still there: they are two of the seven degrees. My scale doesn't discard them, it completes them.

Part IIThe music

Tone, tone, semitone… Each degree has a simple ratio to the base: 9/8, 5/4, 4/3, 3/2.

1I9/8II5/4III4/3IV3/2V5/3VI15/8VII2I C major: white keys only

The seven steps of an octave

Major
×9/8×10/9×16/15×9/8×10/9×9/8×16/15
Minor
×9/8×16/15×10/9×9/8×16/15×9/8×10/9

major tone ×9/8minor tone ×10/9semitone ×16/15

One octave from 16 to 32 px. 16 px sounds as middle C.

Just versus equal temperament

Fifth just 3/2 → 24tempered 23.97
Major third just 5/4 → 20tempered 20.16
Major sixth just 5/3 → 26.67tempered 26.91

With a base of 16: just intonation gives round numbers; piano tuning, decimals.

Read in detail2 sections: The ratio of each degree · Why just intonation

3The ratio of each degree#

3.1 Major scale#

DegreeNameRatio to the baseStep from the previous degree
ITonic1—
IISupertonic9/8 = 1.125× 9/8 (major tone)
IIIMediant5/4 = 1.25× 10/9 (minor tone)
IVSubdominant4/3 = 1.333× 16/15 (semitone)
VDominant3/2 = 1.5× 9/8 (major tone)
VISubmediant5/3 = 1.667× 10/9 (minor tone)
VIILeading tone15/8 = 1.875× 9/8 (major tone)
IOctave2× 16/15 (semitone)

The major pattern is tone, tone, semitone, tone, tone, tone, semitone.

3.2 Minor scale#

This is the natural minor. It shares the tonic, second, fourth and fifth with the major, and lowers the third, sixth and seventh.

DegreeNameRatio to the baseStep from the previous degree
ITonic1—
IISupertonic9/8 = 1.125× 9/8 (major tone)
IIIMediant6/5 = 1.2× 16/15 (semitone)
IVSubdominant4/3 = 1.333× 10/9 (minor tone)
VDominant3/2 = 1.5× 9/8 (major tone)
VISubmediant8/5 = 1.6× 16/15 (semitone)
VIISubtonic9/5 = 1.8× 9/8 (major tone)
IOctave2× 10/9 (minor tone)

The minor pattern is tone, semitone, tone, tone, semitone, tone, tone.

4Why just intonation#

There are two ways to set the ratios. Just intonation uses fractions of small whole numbers (3/2, 5/4…), the ones that come from the physics of sound. Equal temperament, the tuning of the modern piano, splits the octave into twelve equal semitones of 2^(1/12) ≈ 1.0595, and the ratios stop being fractions: the tempered fifth is 1.4983 and the major third, 1.2599.

For a size scale, just intonation is better. With simple fractions, a base of 4 gives whole numbers or a short decimal: with a base of 16, the fifth is 24 rather than 23.97, and the major third is 20 rather than 20.16. Equal temperament only makes sense if you want to move the scale to any key, which an interface doesn't need.

Part IIIThe scale

A 4 px base, eight octaves and 57 sizes, each with a name that says where it sits: 16-5 is 24 px, 1.5 rem.

A1616-1A1816-2A2016-3A21.316-4A2416-5A26.716-6A3016-7A3232-1

Eight octaves, 57 sizes

OctaveIIIIIIIVVVIVII
440.25 rem4.50.2813 rem50.3125 rem5.330.3333 rem60.375 rem6.670.4167 rem7.50.4688 rem
880.5 rem90.5625 rem100.625 rem10.670.6667 rem120.75 rem13.330.8333 rem150.9375 rem
16161 rem181.125 rem201.25 rem21.331.3333 rem241.5 rem26.671.6667 rem301.875 rem
32322 rem362.25 rem402.5 rem42.672.6667 rem483 rem53.333.3333 rem603.75 rem
64644 rem724.5 rem805 rem85.335.3333 rem966 rem106.676.6667 rem1207.5 rem
1281288 rem1449 rem16010 rem170.6710.6667 rem19212 rem213.3313.3333 rem24015 rem
25625616 rem28818 rem32020 rem341.3321.3333 rem38424 rem426.6726.6667 rem48030 rem
51251232 rem57636 rem64040 rem682.6742.6667 rem76848 rem853.3353.3333 rem96060 rem
1,0241,02464 rem
OctaveIIIIIIIVVVIVII
440.25 rem4.50.2813 rem4.80.3 rem5.330.3333 rem60.375 rem6.40.4 rem7.20.45 rem
880.5 rem90.5625 rem9.60.6 rem10.670.6667 rem120.75 rem12.80.8 rem14.40.9 rem
16161 rem181.125 rem19.21.2 rem21.331.3333 rem241.5 rem25.61.6 rem28.81.8 rem
32322 rem362.25 rem38.42.4 rem42.672.6667 rem483 rem51.23.2 rem57.63.6 rem
64644 rem724.5 rem76.84.8 rem85.335.3333 rem966 rem102.46.4 rem115.27.2 rem
1281288 rem1449 rem153.69.6 rem170.6710.6667 rem19212 rem204.812.8 rem230.414.4 rem
25625616 rem28818 rem307.219.2 rem341.3321.3333 rem38424 rem409.625.6 rem460.828.8 rem
51251232 rem57636 rem614.438.4 rem682.6742.6667 rem76848 rem819.251.2 rem921.657.6 rem
1,0241,02464 rem

whole numberdegrees I and V, the most stable series

How to read a name

16-5

16 the tonic of the octave: the size of degree I

5 the degree: the fifth, ×3/2

= 24 px · 1.5 rem · --size-16-5: 1.5rem;

Read in detail4 sections: The sizes with a 4 px base · How each size is named · Pixels and rem · Rounding

5The sizes with a 4 px base#

5.1 Major#

OctaveIIIIIIIVVVIVII
444.555.3366.677.5
8891010.671213.3315
1616182021.332426.6730
3232364042.674853.3360
6464728085.3396106.67120
128128144160170.67192213.33240
256256288320341.33384426.67480
512512576640682.67768853.33960

5.2 Minor#

OctaveIIIIIIIVVVIVII
444.54.85.3366.47.2
8899.610.671212.814.4
16161819.221.332425.628.8
32323638.442.674851.257.6
64647276.885.3396102.4115.2
128128144153.6170.67192204.8230.4
256256288307.2341.33384409.6460.8
512512576614.4682.67768819.2921.6

Between 4 and 1,024 px, each scale gives 57 sizes: seven per octave over eight octaves, plus 1,024. In the major, 39 are whole numbers; in the minor, 24. Over the same range, multiplying by 1.5 gives 14 sizes and by 1.333, 20.

6How each size is named#

Each size is named by the tonic of its octave and its degree: 16-5 is the fifth of the 16 octave, that is, 24 px. As a CSS variable: --size-16-5: 1.5rem, which is 24 px (see §7).

The name says where each size sits, not just how big it is. The same degree in two consecutive octaves is exactly double: 16-5 is 24 and 32-5 is 48. And degrees I and V of each octave form the most stable series in the scale: 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128…

7Pixels and rem#

Each size can be written in pixels or in rem. One rem is the text size of the document root, 16 px by default, and writing in rem makes the whole interface respect the text size each person has chosen in their browser.

With a base of 4, the scale fits rem naturally: the tonic of the 16 octave is exactly 1 rem, and every other size is a simple fraction of it.

NamePixelsrem
4-140.25
8-180.5
8-5120.75
16-1161
16-2181.125
16-3201.25
16-5241.5
16-7301.875
32-1322
32-5483
64-1644
256-538424
512-576848

Design talks in pixels, which read better, and in code the variables are written in rem, with their pixel value in a comment: --size-16-5: 1.5rem; /* 24px */.

8Rounding#

The exact ratios give a few decimals: thirds in degrees IV and VI of the major (5.33; 10.67; 21.33…) and tenths in the minor (4.8; 19.2; 25.6…). In large sizes they matter less: 853.33 px rounded to 853 is off by less than 0.04%. They can be used in two ways:

  • Exact Browsers draw text with sub-pixel precision, so 21.33 px text looks like exactly that.

  • Rounded In borders, spacing and heights, half a pixel can show up as a blurry edge, so it's better to round to the pixel or the half pixel.

The generator computes both versions.

Part IVFor everything

Text, spacing, controls, cards and blocks come from the same scale. And every clamp() starts and ends on a note.

384 · 256-5 192 · 128-5 40 · 32-3 24 · 16-5 title 24text 16/24

Text, with its line height

Title48/60 px · 3/3.75 rem32-5 / 32-7

Designing with a scale

Section title30/36 px · 1.875/2.25 rem16-7 / 32-2

Every size has its note

Lead20/30 px · 1.25/1.875 rem16-3 / 16-7

The scale sets the rhythm of the whole page.

Body text16/24 px · 1/1.5 rem16-1 / 16-5

Body line height is its fifth: 16 on 24. Spacing, radii and controls come from the same series.

Small text12/18 px · 0.75/1.125 rem8-5 / 16-2

Captions, labels and notes: 12 on 18.

Fluid with clamp()

Proportions on any screen

Each size starts and ends on a note of the scale.

space between sections
Title40 px32-1 → 32-5 · fifthclamp(2rem, 1.5714rem + 1.7857vw, 3rem)
Section title27 px16-5 → 16-7 · major thirdclamp(1.5rem, 1.3393rem + 0.6696vw, 1.875rem)
Body text17 px16-1 → 16-2 · a toneclamp(1rem, 0.9464rem + 0.2232vw, 1.125rem)
Space between sections72 px32-5 → 64-5 · octaveclamp(3rem, 1.7143rem + 5.3571vw, 6rem)

I use clamp() this way throughout my process, and it is one of the reasons my design holds its quality: the ends are always notes of the scale and the proportions hold on any screen.

Cards and large blocks

Container 960 · 512-7 288 · 256-2288 · 256-2288 · 256-2 4848 384 × 1922:1 · octave 384 × 2563:2 · fifth
3 × 288 + 2 × 48 = 960: large pieces fit because they are simple ratios of each other.

Major or minor (16 octave)

III
major 20minor 19.2
VI
major 26.67minor 25.6
VII
major 30minor 28.8

They share I, II, IV and V. The minor lowers the third, sixth and seventh.

Read in detail5 sections: Text and line height · Spacing, radii, icons and controls · Cards and large blocks · Fluid sizes with clamp() · Major or minor

9Text and line height#

There's a single scale for everything, so text and its line height come from it too. An example layout with the major scale and a 4 px base:

UseSizeNameLine heightName
Small text12 px · 0.75 rem8-518 px · 1.125 rem16-2
Body text16 px · 1 rem16-124 px · 1.5 rem16-5
Lead20 px · 1.25 rem16-330 px · 1.875 rem16-7
Section title30 px · 1.875 rem16-736 px · 2.25 rem32-2
Title48 px · 3 rem32-560 px · 3.75 rem32-7

In running text, the line height is the fifth of its size: 12 → 18, 16 → 24, 20 → 30. In titles the interval is shorter, a third (30 → 36 is ×6/5 and 48 → 60 is ×5/4), because large lines need less air between them.

10Spacing, radii, icons and controls#

Every size in the interface comes from the scale. An example layout with the major scale and a 4 px base:

UseSizes
Spacing4, 8, 12, 16, 24, 32, 48 and 64, and for fine-tuning, 6, 10, 20 and 40
Radii4, 6, 8, 12 and 16
Icons16, 20, 24 and 32
Control heights32, 36, 40 and 48

The main spacing values are the tonics and dominants (degrees I and V): the familiar 4 and 8 px grid. The other degrees give the in-between steps when a space needs fine-tuning, without making up a number that isn't in the scale.

11Cards and large blocks#

The scale keeps rising with the same pattern above 100 pixels, so it also gives the widths and heights of large pieces. An example layout:

PieceSizeName
Card image192 px · 12 rem high128-5
Card384 px · 24 rem wide256-5
Reading column640 px · 40 rem wide512-3
Content block768 px · 48 rem wide512-5
Page container960 px · 60 rem or 1,024 px · 64 rem wide512-7 or 1024-1

Since every size is a simple ratio of the others, the pieces fit together: three 288 columns (256-2) with two 48 gaps fill the 960 container exactly. And the proportions are intervals too: a 384 × 192 card is an octave (2:1) and a 384 × 256 image, a fifth (3:2).

12Fluid sizes with clamp()#

12.1 The scale sets the ends#

A fixed size works for one screen; on the web, the same title has to look right on a phone and on a monitor. For that I use CSS clamp(), which grows a size with the screen width between a minimum and a maximum: clamp(minimum, preferred, maximum).

The rule is that the minimum and the maximum are always two sizes from the scale. What changes with the screen is the path between them, never the ends. And the screen widths it grows between come from the scale too: from 384 px (256-5) to 1,280 px (1024-3).

I use clamp() this way throughout my process, and it is one of the reasons my design holds its quality: it keeps its proportions on any screen. On a phone and on a monitor, each size starts and ends on a note of the scale, and the relationships between text, spacing and pieces hold while the screen changes.

12.2 Examples#

UseMinimumMaximumIntervalCSS
Body text16 px · 1 rem (16-1)18 px · 1.125 rem (16-2)a toneclamp(1rem, 0.9464rem + 0.2232vw, 1.125rem)
Lead20 px · 1.25 rem (16-3)24 px · 1.5 rem (16-5)minor thirdclamp(1.25rem, 1.1429rem + 0.4464vw, 1.5rem)
Section title24 px · 1.5 rem (16-5)30 px · 1.875 rem (16-7)major thirdclamp(1.5rem, 1.3393rem + 0.6696vw, 1.875rem)
Title32 px · 2 rem (32-1)48 px · 3 rem (32-5)fifthclamp(2rem, 1.5714rem + 1.7857vw, 3rem)
Side margin16 px · 1 rem (16-1)32 px · 2 rem (32-1)octaveclamp(1rem, 0.5714rem + 1.7857vw, 2rem)
Space between sections48 px · 3 rem (32-5)96 px · 6 rem (64-5)octaveclamp(3rem, 1.7143rem + 5.3571vw, 6rem)

The step between the minimum and the maximum is an interval too, chosen by how much each thing should grow: running text barely changes (a tone), titles grow a fifth and large spaces, an octave.

12.3 How it's calculated#

The preferred value is a straight line that passes through the minimum on the narrowest screen and the maximum on the widest. With a minimum a, a maximum b and screens from 384 to 1,280 px:

  • slope = (b − a) ÷ (1,280 − 384), written in CSS as slope × 100 vw;
  • starting point = a − slope × 384, written in rem so it respects the text size each person has chosen.

The generator works it out: you choose how many degrees each size rises and it exports every clamp().

13Major or minor#

The two scales share four degrees (I, II, IV and V), so the most used sizes (4, 6, 8, 12, 16, 24, 32, 48…) are the same in both. The third, sixth and seventh change, and in the minor they sit a little lower:

Degree (16 octave)MajorMinor
III2019.2
VI26.6725.6
VII3028.8

The major gives more whole numbers (39 out of 57, against 24). The minor brings the third closer to the second and the sixth closer to the fifth, with tighter steps in the in-between sizes. Choosing one or the other changes the character of those sizes without touching the structure.

Part VBefore and after

The same card with three systems: by eye, with two scales that don't talk and with a single musical scale.

Before · by eye After · musical scale each tick is a size of the scale

The same card, three systems

By eye · Each number picked on the spot. 4 of 11 measurements on the scale

Guide

An example card

The same content, with each system's measurements.

See more
  • Width370off-scale
  • Image200off-scale
  • Padding22off-scale
  • Radius108-3
  • Eyebrow11off-scale
  • Its line height1616-1
  • Title22off-scale
  • Its line height28off-scale
  • Text158-7
  • Its line height22off-scale
  • Gap108-3
  • Button (height)42off-scale
  • Button text14off-scale
  • Button radius64-5
41664256

Two scales · Text ×1.25 and spacing 8 by 8. 4 of 10 measurements on the scale

Guide

An example card

The same content, with each system's measurements.

See more
  • Width360off-scale
  • Image200off-scale
  • Padding2416-5
  • Radius88-1
  • Eyebrow12.8off-scale
  • Its line height19.2off-scale
  • Title25off-scale
  • Its line height37.5off-scale
  • Text1616-1
  • Its line height2416-5
  • Gap88-1
  • Button (height)4032-3
  • Button text1616-1
  • Button radius88-1
41664256

Musical scale · Everything from the same scale. 9 of 9 measurements on the scale

Guide

An example card

The same content, with each system's measurements.

See more
  • Width384256-5
  • Image192128-5
  • Padding2416-5
  • Radius1616-1
  • Eyebrow128-5
  • Its line height1816-2
  • Title2416-5
  • Its line height3016-7
  • Text1616-1
  • Its line height2416-5
  • Gap88-1
  • Button (height)4032-3
  • Button text1616-1
  • Button radius88-1
41664256

What changes

You decide oncePick a degree and the scale says how big it is.
One language16-5 is the same in the design and in the code.
Repeating proportions3:2, 5:4 and 2:1 in text, spacing and pieces.
It grows without breakingA new piece doesn't bring new numbers.
Read in detail2 sections: Three ways to choose sizes · What changes

14Three ways to choose sizes#

14.1 By eye#

It's the most common approach when there's no system: each size is picked on the spot and nudged until it "looks right". A typical card ends up with 15 text, a 22 title, 22 padding, a 10 radius, a 42 button and a 370 width. Each number makes sense on its own, but there's no relationship between them: nobody can work out the next one, and every new screen adds different numbers.

14.2 Two scales that don't talk#

It's what many design systems do: a modular scale for text (for example ×1.25: 12.8, 16, 20, 25, 31.25…) and a linear 8-by-8 grid for spacing (8, 16, 24, 32, 40…). Each scale is consistent with itself, but not with the other: a 25 title with its 37.5 line height doesn't land on the grid, and the widths of large pieces fall outside both.

14.3 A single musical scale#

With my scale, text, spacing, radii, controls and widths come from the same series. Every size is a simple ratio of the others, and the octaves land on the 4 px grid. The example card ends up with 16 text on 24, a 24 title on 30, 24 padding, a 16 radius, a 40 button and a 384 width: every number belongs to the same scale.

15What changes#

  • You decide once You don't pick a number every time: you pick a degree, and the scale already says how big it is.

  • One language for design and engineering. 16-5 means the same in the design and in the code, and works the same for text as for spacing.
  • Proportions repeat Line heights, margins and widths keep the same ratios (3:2, 5:4, 2:1) across every size on the page, which is why the whole feels ordered even if nobody knows why.

  • It grows without breaking A new piece doesn't bring new numbers: it uses the degrees that already exist. Changing the base or switching from major to minor moves everything at once and keeps the relationships.

The interactive in this part shows the same card with the three systems and places each measurement on the scale: with the first two, many sizes fall between the notes; with the musical scale, they all land on one.

Part VIThe generator

Compute the scale with your base, listen to it and copy the variables in rem, with their clamp() if you want them fluid.

Major ♪ 261.63 Hz

Scale generator

Scale

57 sizes · 39 whole numbers

ListenNameDegreeRatiopxremSize
4-1I1/140.25
4-2II9/84.50.2813
4-3III5/450.3125
4-4IV4/35.330.3333
4-5V3/260.375
4-6VI5/36.670.4167
4-7VII15/87.50.4688
8-1I1/180.5
8-2II9/890.5625
8-3III5/4100.625
8-4IV4/310.670.6667
8-5V3/2120.75
8-6VI5/313.330.8333
8-7VII15/8150.9375
16-1I1/1161
16-2II9/8181.125
16-3III5/4201.25
16-4IV4/321.331.3333
16-5V3/2241.5
16-6VI5/326.671.6667
16-7VII15/8301.875
32-1I1/1322
32-2II9/8362.25
32-3III5/4402.5
32-4IV4/342.672.6667
32-5V3/2483
32-6VI5/353.333.3333
32-7VII15/8603.75
64-1I1/1644
64-2II9/8724.5
64-3III5/4805
64-4IV4/385.335.3333
64-5V3/2966
64-6VI5/3106.676.6667
64-7VII15/81207.5
128-1I1/11288
128-2II9/81449
128-3III5/416010
128-4IV4/3170.6710.6667
128-5V3/219212
128-6VI5/3213.3313.3333
128-7VII15/824015
256-1I1/125616
256-2II9/828818
256-3III5/432020
256-4IV4/3341.3321.3333
256-5V3/238424
256-6VI5/3426.6726.6667
256-7VII15/848030
512-1I1/151232
512-2II9/857636
512-3III5/464040
512-4IV4/3682.6742.6667
512-5V3/276848
512-6VI5/3853.3353.3333
512-7VII15/896060
1024-1I1/11,02464
:root {
  /* Musical scale · major · 4px base · just intonation */
  --size-4-1: 0.25rem; /* 4px */
  --size-4-2: 0.2813rem; /* 4.5px */
  --size-4-3: 0.3125rem; /* 5px */
  --size-4-4: 0.3333rem; /* 5.33px */
  --size-4-5: 0.375rem; /* 6px */
  --size-4-6: 0.4167rem; /* 6.67px */
  --size-4-7: 0.4688rem; /* 7.5px */
  --size-8-1: 0.5rem; /* 8px */
  --size-8-2: 0.5625rem; /* 9px */
  --size-8-3: 0.625rem; /* 10px */
  --size-8-4: 0.6667rem; /* 10.67px */
  --size-8-5: 0.75rem; /* 12px */
  --size-8-6: 0.8333rem; /* 13.33px */
  --size-8-7: 0.9375rem; /* 15px */
  --size-16-1: 1rem; /* 16px */
  --size-16-2: 1.125rem; /* 18px */
  --size-16-3: 1.25rem; /* 20px */
  --size-16-4: 1.3333rem; /* 21.33px */
  --size-16-5: 1.5rem; /* 24px */
  --size-16-6: 1.6667rem; /* 26.67px */
  --size-16-7: 1.875rem; /* 30px */
  --size-32-1: 2rem; /* 32px */
  --size-32-2: 2.25rem; /* 36px */
  --size-32-3: 2.5rem; /* 40px */
  --size-32-4: 2.6667rem; /* 42.67px */
  --size-32-5: 3rem; /* 48px */
  --size-32-6: 3.3333rem; /* 53.33px */
  --size-32-7: 3.75rem; /* 60px */
  --size-64-1: 4rem; /* 64px */
  --size-64-2: 4.5rem; /* 72px */
  --size-64-3: 5rem; /* 80px */
  --size-64-4: 5.3333rem; /* 85.33px */
  --size-64-5: 6rem; /* 96px */
  --size-64-6: 6.6667rem; /* 106.67px */
  --size-64-7: 7.5rem; /* 120px */
  --size-128-1: 8rem; /* 128px */
  --size-128-2: 9rem; /* 144px */
  --size-128-3: 10rem; /* 160px */
  --size-128-4: 10.6667rem; /* 170.67px */
  --size-128-5: 12rem; /* 192px */
  --size-128-6: 13.3333rem; /* 213.33px */
  --size-128-7: 15rem; /* 240px */
  --size-256-1: 16rem; /* 256px */
  --size-256-2: 18rem; /* 288px */
  --size-256-3: 20rem; /* 320px */
  --size-256-4: 21.3333rem; /* 341.33px */
  --size-256-5: 24rem; /* 384px */
  --size-256-6: 26.6667rem; /* 426.67px */
  --size-256-7: 30rem; /* 480px */
  --size-512-1: 32rem; /* 512px */
  --size-512-2: 36rem; /* 576px */
  --size-512-3: 40rem; /* 640px */
  --size-512-4: 42.6667rem; /* 682.67px */
  --size-512-5: 48rem; /* 768px */
  --size-512-6: 53.3333rem; /* 853.33px */
  --size-512-7: 60rem; /* 960px */
  --size-1024-1: 64rem; /* 1024px */
}
Read in detail2 sections: How to use it · Glossary

16How to use it#

The generator in this part computes the scale with any base:

  1. Base: the size of the first tonic (4 px by default).
  2. Scale: major or minor.
  3. Range: up to which octave it goes.
  4. Rounding: exact, to the half pixel or to the pixel.
  5. Fluid: whether each size grows with the screen and how many degrees it rises (a tone, a third, a fifth or an octave), with the minimum and maximum screen widths.
  6. Prefix: the variable name (size by default).

You can listen to every size. The tonic of the third octave (16 px with a base of 4) sounds as middle C, at 261.63 Hz, and every other size keeps its ratio to it: what you hear is the scale you see. Very small or very large sizes play one or more octaves closer to the middle, so they can be heard comfortably. Below are the variables ready to copy, as CSS (in rem, with the pixels in a comment, or with their clamp() if you chose fluid) or as JSON.

17Glossary#

  • Base: the size of the first tonic. Every other size comes from multiplying it.
  • Degree: each of the seven notes of the scale, from I to VII.
  • Tonic: degree I, the one that names each octave.
  • Dominant: degree V, 3/2 (×1.5) above the tonic.
  • Subdominant: degree IV, 4/3 (×1.333) above the tonic.
  • Octave: the step that doubles the size (×2).
  • Major tone, minor tone and semitone: the three steps of just intonation: ×9/8, ×10/9 and ×16/15.
  • Just intonation: ratios of small whole numbers.
  • Equal temperament: twelve equal semitones of 2^(1/12); the tuning of the modern piano.
  • Modular scale: one that always multiplies by the same ratio.
  • rem: the text size of the document root (16 px by default); the unit the variables are written in.
  • clamp(): the CSS function that grows a size with the screen between a minimum and a maximum. In this scale, both ends are degrees.
  • Linear grid: one that always adds the same amount, such as 8 by 8.

Volver arribaBack to top ↑