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.
En vídeo
La idea en tres frases
En cifras
Las seis partes
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#
| Parte | Secciones | Para quién |
|---|---|---|
| I. La idea | §1 Multiplicar siempre por lo mismo · §2 Lo que hace la música | Cualquiera, en cinco minutos |
| II. La música | §3 Las razones de cada grado · §4 Por qué afinación justa | Quien 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 redondeo | Diseñ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 menor | Quien la vaya a aplicar |
| V. Antes y después | §14 Tres formas de elegir tamaños · §15 Lo que cambia | Quien compare sistemas de diseño |
| VI. El generador | §16 Cómo usarlo · §17 Glosario | Todos |
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.
Entre 4 y 1.024 px
Los primeros ocho pasos
46913,520,2530,3845,5668,3445,337,119,4812,6416,8622,4729,9744,555,3366,677,58La 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.
Los siete saltos de una octava
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
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#
| Grado | Nombre | Razón con la base | Salto desde el grado anterior |
|---|---|---|---|
| I | Tónica | 1 | — |
| II | Supertónica | 9/8 = 1,125 | × 9/8 (tono mayor) |
| III | Mediante | 5/4 = 1,25 | × 10/9 (tono menor) |
| IV | Subdominante | 4/3 = 1,333 | × 16/15 (semitono) |
| V | Dominante | 3/2 = 1,5 | × 9/8 (tono mayor) |
| VI | Superdominante | 5/3 = 1,667 | × 10/9 (tono menor) |
| VII | Sensible | 15/8 = 1,875 | × 9/8 (tono mayor) |
| I | Octava | 2 | × 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.
| Grado | Nombre | Razón con la base | Salto desde el grado anterior |
|---|---|---|---|
| I | Tónica | 1 | — |
| II | Supertónica | 9/8 = 1,125 | × 9/8 (tono mayor) |
| III | Mediante | 6/5 = 1,2 | × 16/15 (semitono) |
| IV | Subdominante | 4/3 = 1,333 | × 10/9 (tono menor) |
| V | Dominante | 3/2 = 1,5 | × 9/8 (tono mayor) |
| VI | Superdominante | 8/5 = 1,6 | × 16/15 (semitono) |
| VII | Subtónica | 9/5 = 1,8 | × 9/8 (tono mayor) |
| I | Octava | 2 | × 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.
Ocho octavas, 57 tamaños
| Octava | I | II | III | IV | V | VI | VII |
|---|---|---|---|---|---|---|---|
| 4 | 40,25 rem | 4,50,2813 rem | 50,3125 rem | 5,330,3333 rem | 60,375 rem | 6,670,4167 rem | 7,50,4688 rem |
| 8 | 80,5 rem | 90,5625 rem | 100,625 rem | 10,670,6667 rem | 120,75 rem | 13,330,8333 rem | 150,9375 rem |
| 16 | 161 rem | 181,125 rem | 201,25 rem | 21,331,3333 rem | 241,5 rem | 26,671,6667 rem | 301,875 rem |
| 32 | 322 rem | 362,25 rem | 402,5 rem | 42,672,6667 rem | 483 rem | 53,333,3333 rem | 603,75 rem |
| 64 | 644 rem | 724,5 rem | 805 rem | 85,335,3333 rem | 966 rem | 106,676,6667 rem | 1207,5 rem |
| 128 | 1288 rem | 1449 rem | 16010 rem | 170,6710,6667 rem | 19212 rem | 213,3313,3333 rem | 24015 rem |
| 256 | 25616 rem | 28818 rem | 32020 rem | 341,3321,3333 rem | 38424 rem | 426,6726,6667 rem | 48030 rem |
| 512 | 51232 rem | 57636 rem | 64040 rem | 682,6742,6667 rem | 76848 rem | 853,3353,3333 rem | 96060 rem |
| 1.024 | 1.02464 rem | ||||||
| Octava | I | II | III | IV | V | VI | VII |
|---|---|---|---|---|---|---|---|
| 4 | 40,25 rem | 4,50,2813 rem | 4,80,3 rem | 5,330,3333 rem | 60,375 rem | 6,40,4 rem | 7,20,45 rem |
| 8 | 80,5 rem | 90,5625 rem | 9,60,6 rem | 10,670,6667 rem | 120,75 rem | 12,80,8 rem | 14,40,9 rem |
| 16 | 161 rem | 181,125 rem | 19,21,2 rem | 21,331,3333 rem | 241,5 rem | 25,61,6 rem | 28,81,8 rem |
| 32 | 322 rem | 362,25 rem | 38,42,4 rem | 42,672,6667 rem | 483 rem | 51,23,2 rem | 57,63,6 rem |
| 64 | 644 rem | 724,5 rem | 76,84,8 rem | 85,335,3333 rem | 966 rem | 102,46,4 rem | 115,27,2 rem |
| 128 | 1288 rem | 1449 rem | 153,69,6 rem | 170,6710,6667 rem | 19212 rem | 204,812,8 rem | 230,414,4 rem |
| 256 | 25616 rem | 28818 rem | 307,219,2 rem | 341,3321,3333 rem | 38424 rem | 409,625,6 rem | 460,828,8 rem |
| 512 | 51232 rem | 57636 rem | 614,438,4 rem | 682,6742,6667 rem | 76848 rem | 819,251,2 rem | 921,657,6 rem |
| 1.024 | 1.02464 rem | ||||||
número enterogrados I y V, la serie más estable
Cómo se lee un nombre
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#
| Octava | I | II | III | IV | V | VI | VII |
|---|---|---|---|---|---|---|---|
| 4 | 4 | 4,5 | 5 | 5,33 | 6 | 6,67 | 7,5 |
| 8 | 8 | 9 | 10 | 10,67 | 12 | 13,33 | 15 |
| 16 | 16 | 18 | 20 | 21,33 | 24 | 26,67 | 30 |
| 32 | 32 | 36 | 40 | 42,67 | 48 | 53,33 | 60 |
| 64 | 64 | 72 | 80 | 85,33 | 96 | 106,67 | 120 |
| 128 | 128 | 144 | 160 | 170,67 | 192 | 213,33 | 240 |
| 256 | 256 | 288 | 320 | 341,33 | 384 | 426,67 | 480 |
| 512 | 512 | 576 | 640 | 682,67 | 768 | 853,33 | 960 |
5.2 Menor#
| Octava | I | II | III | IV | V | VI | VII |
|---|---|---|---|---|---|---|---|
| 4 | 4 | 4,5 | 4,8 | 5,33 | 6 | 6,4 | 7,2 |
| 8 | 8 | 9 | 9,6 | 10,67 | 12 | 12,8 | 14,4 |
| 16 | 16 | 18 | 19,2 | 21,33 | 24 | 25,6 | 28,8 |
| 32 | 32 | 36 | 38,4 | 42,67 | 48 | 51,2 | 57,6 |
| 64 | 64 | 72 | 76,8 | 85,33 | 96 | 102,4 | 115,2 |
| 128 | 128 | 144 | 153,6 | 170,67 | 192 | 204,8 | 230,4 |
| 256 | 256 | 288 | 307,2 | 341,33 | 384 | 409,6 | 460,8 |
| 512 | 512 | 576 | 614,4 | 682,67 | 768 | 819,2 | 921,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.
| Nombre | Píxeles | rem |
|---|---|---|
| 4-1 | 4 | 0,25 |
| 8-1 | 8 | 0,5 |
| 8-5 | 12 | 0,75 |
| 16-1 | 16 | 1 |
| 16-2 | 18 | 1,125 |
| 16-3 | 20 | 1,25 |
| 16-5 | 24 | 1,5 |
| 16-7 | 30 | 1,875 |
| 32-1 | 32 | 2 |
| 32-5 | 48 | 3 |
| 64-1 | 64 | 4 |
| 256-5 | 384 | 24 |
| 512-5 | 768 | 48 |
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.
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.
clamp(2rem, 1.5714rem + 1.7857vw, 3rem)clamp(1.5rem, 1.3393rem + 0.6696vw, 1.875rem)clamp(1rem, 0.9464rem + 0.2232vw, 1.125rem)clamp(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
Mayor o menor (octava de 16)
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:
| Uso | Tamaño | Nombre | Interlineado | Nombre |
|---|---|---|---|---|
| Texto pequeño | 12 px · 0,75 rem | 8-5 | 18 px · 1,125 rem | 16-2 |
| Texto | 16 px · 1 rem | 16-1 | 24 px · 1,5 rem | 16-5 |
| Entradilla | 20 px · 1,25 rem | 16-3 | 30 px · 1,875 rem | 16-7 |
| Título de sección | 30 px · 1,875 rem | 16-7 | 36 px · 2,25 rem | 32-2 |
| Título | 48 px · 3 rem | 32-5 | 60 px · 3,75 rem | 32-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:
| Uso | Tamaños |
|---|---|
| Espacios | 4, 8, 12, 16, 24, 32, 48 y 64, y para afinar, 6, 10, 20 y 40 |
| Radios | 4, 6, 8, 12 y 16 |
| Iconos | 16, 20, 24 y 32 |
| Alturas de control | 32, 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:
| Pieza | Tamaño | Nombre |
|---|---|---|
| Imagen de una tarjeta | 192 px · 12 rem de alto | 128-5 |
| Tarjeta | 384 px · 24 rem de ancho | 256-5 |
| Columna de lectura | 640 px · 40 rem de ancho | 512-3 |
| Bloque de contenido | 768 px · 48 rem de ancho | 512-5 |
| Contenedor de página | 960 px · 60 rem o 1.024 px · 64 rem de ancho | 512-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#
| Uso | Mínimo | Máximo | Intervalo | CSS |
|---|---|---|---|---|
| Texto | 16 px · 1 rem (16-1) | 18 px · 1,125 rem (16-2) | un tono | clamp(1rem, 0.9464rem + 0.2232vw, 1.125rem) |
| Entradilla | 20 px · 1,25 rem (16-3) | 24 px · 1,5 rem (16-5) | tercera menor | clamp(1.25rem, 1.1429rem + 0.4464vw, 1.5rem) |
| Título de sección | 24 px · 1,5 rem (16-5) | 30 px · 1,875 rem (16-7) | tercera mayor | clamp(1.5rem, 1.3393rem + 0.6696vw, 1.875rem) |
| Título | 32 px · 2 rem (32-1) | 48 px · 3 rem (32-5) | quinta | clamp(2rem, 1.5714rem + 1.7857vw, 3rem) |
| Margen lateral | 16 px · 1 rem (16-1) | 32 px · 2 rem (32-1) | octava | clamp(1rem, 0.5714rem + 1.7857vw, 2rem) |
| Espacio entre secciones | 48 px · 3 rem (32-5) | 96 px · 6 rem (64-5) | octava | clamp(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
rempara 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) | Mayor | Menor |
|---|---|---|
| III | 20 | 19,2 |
| VI | 26,67 | 25,6 |
| VII | 30 | 28,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.
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- Ancho370
fuera - Imagen200
fuera - Relleno22
fuera - Radio10
8-3 - Antetítulo11
fuera - Su interlineado16
16-1 - Título22
fuera - Su interlineado28
fuera - Texto15
8-7 - Su interlineado22
fuera - Hueco10
8-3 - Botón (alto)42
fuera - Texto del botón14
fuera - Radio del botón6
4-5
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- Ancho360
fuera - Imagen200
fuera - Relleno24
16-5 - Radio8
8-1 - Antetítulo12,8
fuera - Su interlineado19,2
fuera - Título25
fuera - Su interlineado37,5
fuera - Texto16
16-1 - Su interlineado24
16-5 - Hueco8
8-1 - Botón (alto)40
32-3 - Texto del botón16
16-1 - Radio del botón8
8-1
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- Ancho384
256-5 - Imagen192
128-5 - Relleno24
16-5 - Radio16
16-1 - Antetítulo12
8-5 - Su interlineado18
16-2 - Título24
16-5 - Su interlineado30
16-7 - Texto16
16-1 - Su interlineado24
16-5 - Hueco8
8-1 - Botón (alto)40
32-3 - Texto del botón16
16-1 - Radio del botón8
8-1
Lo que cambia
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-5significa 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.
Generador de la escala
57 tamaños · 39 enteros
| Escuchar | Nombre | Grado | Razón | px | rem | Fluido hasta | Tamaño |
|---|---|---|---|---|---|---|---|
4-1 | I | 1/1 | 4 | 0,25 | |||
4-2 | II | 9/8 | 4,5 | 0,2813 | |||
4-3 | III | 5/4 | 5 | 0,3125 | |||
4-4 | IV | 4/3 | 5,33 | 0,3333 | |||
4-5 | V | 3/2 | 6 | 0,375 | |||
4-6 | VI | 5/3 | 6,67 | 0,4167 | |||
4-7 | VII | 15/8 | 7,5 | 0,4688 | |||
8-1 | I | 1/1 | 8 | 0,5 | |||
8-2 | II | 9/8 | 9 | 0,5625 | |||
8-3 | III | 5/4 | 10 | 0,625 | |||
8-4 | IV | 4/3 | 10,67 | 0,6667 | |||
8-5 | V | 3/2 | 12 | 0,75 | |||
8-6 | VI | 5/3 | 13,33 | 0,8333 | |||
8-7 | VII | 15/8 | 15 | 0,9375 | |||
16-1 | I | 1/1 | 16 | 1 | |||
16-2 | II | 9/8 | 18 | 1,125 | |||
16-3 | III | 5/4 | 20 | 1,25 | |||
16-4 | IV | 4/3 | 21,33 | 1,3333 | |||
16-5 | V | 3/2 | 24 | 1,5 | |||
16-6 | VI | 5/3 | 26,67 | 1,6667 | |||
16-7 | VII | 15/8 | 30 | 1,875 | |||
32-1 | I | 1/1 | 32 | 2 | |||
32-2 | II | 9/8 | 36 | 2,25 | |||
32-3 | III | 5/4 | 40 | 2,5 | |||
32-4 | IV | 4/3 | 42,67 | 2,6667 | |||
32-5 | V | 3/2 | 48 | 3 | |||
32-6 | VI | 5/3 | 53,33 | 3,3333 | |||
32-7 | VII | 15/8 | 60 | 3,75 | |||
64-1 | I | 1/1 | 64 | 4 | |||
64-2 | II | 9/8 | 72 | 4,5 | |||
64-3 | III | 5/4 | 80 | 5 | |||
64-4 | IV | 4/3 | 85,33 | 5,3333 | |||
64-5 | V | 3/2 | 96 | 6 | |||
64-6 | VI | 5/3 | 106,67 | 6,6667 | |||
64-7 | VII | 15/8 | 120 | 7,5 | |||
128-1 | I | 1/1 | 128 | 8 | |||
128-2 | II | 9/8 | 144 | 9 | |||
128-3 | III | 5/4 | 160 | 10 | |||
128-4 | IV | 4/3 | 170,67 | 10,6667 | |||
128-5 | V | 3/2 | 192 | 12 | |||
128-6 | VI | 5/3 | 213,33 | 13,3333 | |||
128-7 | VII | 15/8 | 240 | 15 | |||
256-1 | I | 1/1 | 256 | 16 | |||
256-2 | II | 9/8 | 288 | 18 | |||
256-3 | III | 5/4 | 320 | 20 | |||
256-4 | IV | 4/3 | 341,33 | 21,3333 | |||
256-5 | V | 3/2 | 384 | 24 | |||
256-6 | VI | 5/3 | 426,67 | 26,6667 | |||
256-7 | VII | 15/8 | 480 | 30 | |||
512-1 | I | 1/1 | 512 | 32 | |||
512-2 | II | 9/8 | 576 | 36 | |||
512-3 | III | 5/4 | 640 | 40 | |||
512-4 | IV | 4/3 | 682,67 | 42,6667 | |||
512-5 | V | 3/2 | 768 | 48 | |||
512-6 | VI | 5/3 | 853,33 | 53,3333 | |||
512-7 | VII | 15/8 | 960 | 60 | |||
1024-1 | I | 1/1 | 1.024 | 64 |
: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:
- Base: el tamaño de la primera tónica (4 px por defecto).
- Escala: mayor o menor.
- Rango: hasta qué octava llega.
- Redondeo: exacto, al medio píxel o al píxel.
- 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.
- Prefijo: el nombre de las variables (
escalapor 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.
On video
The idea in three sentences
In numbers
The six parts
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#
| Part | Sections | Who it's for |
|---|---|---|
| I. The idea | §1 Always multiplying by the same · §2 What music does | Anyone, in five minutes |
| II. The music | §3 The ratio of each degree · §4 Why just intonation | Anyone 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 Rounding | Design 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 minor | Whoever will apply it |
| V. Before and after | §14 Three ways to choose sizes · §15 What changes | Anyone comparing design systems |
| VI. The generator | §16 How to use it · §17 Glossary | Everyone |
Part IThe idea
Always multiplying by the same gives a single rhythm. Music rises in seven different steps and lands exactly on double.
Between 4 and 1,024 px
The first eight steps
46913.520.2530.3845.5668.3445.337.119.4812.6416.8622.4729.9744.555.3366.677.58The 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.
The seven steps of an octave
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
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#
| Degree | Name | Ratio to the base | Step from the previous degree |
|---|---|---|---|
| I | Tonic | 1 | — |
| II | Supertonic | 9/8 = 1.125 | × 9/8 (major tone) |
| III | Mediant | 5/4 = 1.25 | × 10/9 (minor tone) |
| IV | Subdominant | 4/3 = 1.333 | × 16/15 (semitone) |
| V | Dominant | 3/2 = 1.5 | × 9/8 (major tone) |
| VI | Submediant | 5/3 = 1.667 | × 10/9 (minor tone) |
| VII | Leading tone | 15/8 = 1.875 | × 9/8 (major tone) |
| I | Octave | 2 | × 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.
| Degree | Name | Ratio to the base | Step from the previous degree |
|---|---|---|---|
| I | Tonic | 1 | — |
| II | Supertonic | 9/8 = 1.125 | × 9/8 (major tone) |
| III | Mediant | 6/5 = 1.2 | × 16/15 (semitone) |
| IV | Subdominant | 4/3 = 1.333 | × 10/9 (minor tone) |
| V | Dominant | 3/2 = 1.5 | × 9/8 (major tone) |
| VI | Submediant | 8/5 = 1.6 | × 16/15 (semitone) |
| VII | Subtonic | 9/5 = 1.8 | × 9/8 (major tone) |
| I | Octave | 2 | × 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.
Eight octaves, 57 sizes
| Octave | I | II | III | IV | V | VI | VII |
|---|---|---|---|---|---|---|---|
| 4 | 40.25 rem | 4.50.2813 rem | 50.3125 rem | 5.330.3333 rem | 60.375 rem | 6.670.4167 rem | 7.50.4688 rem |
| 8 | 80.5 rem | 90.5625 rem | 100.625 rem | 10.670.6667 rem | 120.75 rem | 13.330.8333 rem | 150.9375 rem |
| 16 | 161 rem | 181.125 rem | 201.25 rem | 21.331.3333 rem | 241.5 rem | 26.671.6667 rem | 301.875 rem |
| 32 | 322 rem | 362.25 rem | 402.5 rem | 42.672.6667 rem | 483 rem | 53.333.3333 rem | 603.75 rem |
| 64 | 644 rem | 724.5 rem | 805 rem | 85.335.3333 rem | 966 rem | 106.676.6667 rem | 1207.5 rem |
| 128 | 1288 rem | 1449 rem | 16010 rem | 170.6710.6667 rem | 19212 rem | 213.3313.3333 rem | 24015 rem |
| 256 | 25616 rem | 28818 rem | 32020 rem | 341.3321.3333 rem | 38424 rem | 426.6726.6667 rem | 48030 rem |
| 512 | 51232 rem | 57636 rem | 64040 rem | 682.6742.6667 rem | 76848 rem | 853.3353.3333 rem | 96060 rem |
| 1,024 | 1,02464 rem | ||||||
| Octave | I | II | III | IV | V | VI | VII |
|---|---|---|---|---|---|---|---|
| 4 | 40.25 rem | 4.50.2813 rem | 4.80.3 rem | 5.330.3333 rem | 60.375 rem | 6.40.4 rem | 7.20.45 rem |
| 8 | 80.5 rem | 90.5625 rem | 9.60.6 rem | 10.670.6667 rem | 120.75 rem | 12.80.8 rem | 14.40.9 rem |
| 16 | 161 rem | 181.125 rem | 19.21.2 rem | 21.331.3333 rem | 241.5 rem | 25.61.6 rem | 28.81.8 rem |
| 32 | 322 rem | 362.25 rem | 38.42.4 rem | 42.672.6667 rem | 483 rem | 51.23.2 rem | 57.63.6 rem |
| 64 | 644 rem | 724.5 rem | 76.84.8 rem | 85.335.3333 rem | 966 rem | 102.46.4 rem | 115.27.2 rem |
| 128 | 1288 rem | 1449 rem | 153.69.6 rem | 170.6710.6667 rem | 19212 rem | 204.812.8 rem | 230.414.4 rem |
| 256 | 25616 rem | 28818 rem | 307.219.2 rem | 341.3321.3333 rem | 38424 rem | 409.625.6 rem | 460.828.8 rem |
| 512 | 51232 rem | 57636 rem | 614.438.4 rem | 682.6742.6667 rem | 76848 rem | 819.251.2 rem | 921.657.6 rem |
| 1,024 | 1,02464 rem | ||||||
whole numberdegrees I and V, the most stable series
How to read a name
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#
| Octave | I | II | III | IV | V | VI | VII |
|---|---|---|---|---|---|---|---|
| 4 | 4 | 4.5 | 5 | 5.33 | 6 | 6.67 | 7.5 |
| 8 | 8 | 9 | 10 | 10.67 | 12 | 13.33 | 15 |
| 16 | 16 | 18 | 20 | 21.33 | 24 | 26.67 | 30 |
| 32 | 32 | 36 | 40 | 42.67 | 48 | 53.33 | 60 |
| 64 | 64 | 72 | 80 | 85.33 | 96 | 106.67 | 120 |
| 128 | 128 | 144 | 160 | 170.67 | 192 | 213.33 | 240 |
| 256 | 256 | 288 | 320 | 341.33 | 384 | 426.67 | 480 |
| 512 | 512 | 576 | 640 | 682.67 | 768 | 853.33 | 960 |
5.2 Minor#
| Octave | I | II | III | IV | V | VI | VII |
|---|---|---|---|---|---|---|---|
| 4 | 4 | 4.5 | 4.8 | 5.33 | 6 | 6.4 | 7.2 |
| 8 | 8 | 9 | 9.6 | 10.67 | 12 | 12.8 | 14.4 |
| 16 | 16 | 18 | 19.2 | 21.33 | 24 | 25.6 | 28.8 |
| 32 | 32 | 36 | 38.4 | 42.67 | 48 | 51.2 | 57.6 |
| 64 | 64 | 72 | 76.8 | 85.33 | 96 | 102.4 | 115.2 |
| 128 | 128 | 144 | 153.6 | 170.67 | 192 | 204.8 | 230.4 |
| 256 | 256 | 288 | 307.2 | 341.33 | 384 | 409.6 | 460.8 |
| 512 | 512 | 576 | 614.4 | 682.67 | 768 | 819.2 | 921.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.
| Name | Pixels | rem |
|---|---|---|
| 4-1 | 4 | 0.25 |
| 8-1 | 8 | 0.5 |
| 8-5 | 12 | 0.75 |
| 16-1 | 16 | 1 |
| 16-2 | 18 | 1.125 |
| 16-3 | 20 | 1.25 |
| 16-5 | 24 | 1.5 |
| 16-7 | 30 | 1.875 |
| 32-1 | 32 | 2 |
| 32-5 | 48 | 3 |
| 64-1 | 64 | 4 |
| 256-5 | 384 | 24 |
| 512-5 | 768 | 48 |
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.
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.
clamp(2rem, 1.5714rem + 1.7857vw, 3rem)clamp(1.5rem, 1.3393rem + 0.6696vw, 1.875rem)clamp(1rem, 0.9464rem + 0.2232vw, 1.125rem)clamp(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
Major or minor (16 octave)
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:
| Use | Size | Name | Line height | Name |
|---|---|---|---|---|
| Small text | 12 px · 0.75 rem | 8-5 | 18 px · 1.125 rem | 16-2 |
| Body text | 16 px · 1 rem | 16-1 | 24 px · 1.5 rem | 16-5 |
| Lead | 20 px · 1.25 rem | 16-3 | 30 px · 1.875 rem | 16-7 |
| Section title | 30 px · 1.875 rem | 16-7 | 36 px · 2.25 rem | 32-2 |
| Title | 48 px · 3 rem | 32-5 | 60 px · 3.75 rem | 32-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:
| Use | Sizes |
|---|---|
| Spacing | 4, 8, 12, 16, 24, 32, 48 and 64, and for fine-tuning, 6, 10, 20 and 40 |
| Radii | 4, 6, 8, 12 and 16 |
| Icons | 16, 20, 24 and 32 |
| Control heights | 32, 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:
| Piece | Size | Name |
|---|---|---|
| Card image | 192 px · 12 rem high | 128-5 |
| Card | 384 px · 24 rem wide | 256-5 |
| Reading column | 640 px · 40 rem wide | 512-3 |
| Content block | 768 px · 48 rem wide | 512-5 |
| Page container | 960 px · 60 rem or 1,024 px · 64 rem wide | 512-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#
| Use | Minimum | Maximum | Interval | CSS |
|---|---|---|---|---|
| Body text | 16 px · 1 rem (16-1) | 18 px · 1.125 rem (16-2) | a tone | clamp(1rem, 0.9464rem + 0.2232vw, 1.125rem) |
| Lead | 20 px · 1.25 rem (16-3) | 24 px · 1.5 rem (16-5) | minor third | clamp(1.25rem, 1.1429rem + 0.4464vw, 1.5rem) |
| Section title | 24 px · 1.5 rem (16-5) | 30 px · 1.875 rem (16-7) | major third | clamp(1.5rem, 1.3393rem + 0.6696vw, 1.875rem) |
| Title | 32 px · 2 rem (32-1) | 48 px · 3 rem (32-5) | fifth | clamp(2rem, 1.5714rem + 1.7857vw, 3rem) |
| Side margin | 16 px · 1 rem (16-1) | 32 px · 2 rem (32-1) | octave | clamp(1rem, 0.5714rem + 1.7857vw, 2rem) |
| Space between sections | 48 px · 3 rem (32-5) | 96 px · 6 rem (64-5) | octave | clamp(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
remso 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) | Major | Minor |
|---|---|---|
| III | 20 | 19.2 |
| VI | 26.67 | 25.6 |
| VII | 30 | 28.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.
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- Width370
off-scale - Image200
off-scale - Padding22
off-scale - Radius10
8-3 - Eyebrow11
off-scale - Its line height16
16-1 - Title22
off-scale - Its line height28
off-scale - Text15
8-7 - Its line height22
off-scale - Gap10
8-3 - Button (height)42
off-scale - Button text14
off-scale - Button radius6
4-5
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- Width360
off-scale - Image200
off-scale - Padding24
16-5 - Radius8
8-1 - Eyebrow12.8
off-scale - Its line height19.2
off-scale - Title25
off-scale - Its line height37.5
off-scale - Text16
16-1 - Its line height24
16-5 - Gap8
8-1 - Button (height)40
32-3 - Button text16
16-1 - Button radius8
8-1
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- Width384
256-5 - Image192
128-5 - Padding24
16-5 - Radius16
16-1 - Eyebrow12
8-5 - Its line height18
16-2 - Title24
16-5 - Its line height30
16-7 - Text16
16-1 - Its line height24
16-5 - Gap8
8-1 - Button (height)40
32-3 - Button text16
16-1 - Button radius8
8-1
What changes
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-5means 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.
Scale generator
57 sizes · 39 whole numbers
| Listen | Name | Degree | Ratio | px | rem | Fluid up to | Size |
|---|---|---|---|---|---|---|---|
4-1 | I | 1/1 | 4 | 0.25 | |||
4-2 | II | 9/8 | 4.5 | 0.2813 | |||
4-3 | III | 5/4 | 5 | 0.3125 | |||
4-4 | IV | 4/3 | 5.33 | 0.3333 | |||
4-5 | V | 3/2 | 6 | 0.375 | |||
4-6 | VI | 5/3 | 6.67 | 0.4167 | |||
4-7 | VII | 15/8 | 7.5 | 0.4688 | |||
8-1 | I | 1/1 | 8 | 0.5 | |||
8-2 | II | 9/8 | 9 | 0.5625 | |||
8-3 | III | 5/4 | 10 | 0.625 | |||
8-4 | IV | 4/3 | 10.67 | 0.6667 | |||
8-5 | V | 3/2 | 12 | 0.75 | |||
8-6 | VI | 5/3 | 13.33 | 0.8333 | |||
8-7 | VII | 15/8 | 15 | 0.9375 | |||
16-1 | I | 1/1 | 16 | 1 | |||
16-2 | II | 9/8 | 18 | 1.125 | |||
16-3 | III | 5/4 | 20 | 1.25 | |||
16-4 | IV | 4/3 | 21.33 | 1.3333 | |||
16-5 | V | 3/2 | 24 | 1.5 | |||
16-6 | VI | 5/3 | 26.67 | 1.6667 | |||
16-7 | VII | 15/8 | 30 | 1.875 | |||
32-1 | I | 1/1 | 32 | 2 | |||
32-2 | II | 9/8 | 36 | 2.25 | |||
32-3 | III | 5/4 | 40 | 2.5 | |||
32-4 | IV | 4/3 | 42.67 | 2.6667 | |||
32-5 | V | 3/2 | 48 | 3 | |||
32-6 | VI | 5/3 | 53.33 | 3.3333 | |||
32-7 | VII | 15/8 | 60 | 3.75 | |||
64-1 | I | 1/1 | 64 | 4 | |||
64-2 | II | 9/8 | 72 | 4.5 | |||
64-3 | III | 5/4 | 80 | 5 | |||
64-4 | IV | 4/3 | 85.33 | 5.3333 | |||
64-5 | V | 3/2 | 96 | 6 | |||
64-6 | VI | 5/3 | 106.67 | 6.6667 | |||
64-7 | VII | 15/8 | 120 | 7.5 | |||
128-1 | I | 1/1 | 128 | 8 | |||
128-2 | II | 9/8 | 144 | 9 | |||
128-3 | III | 5/4 | 160 | 10 | |||
128-4 | IV | 4/3 | 170.67 | 10.6667 | |||
128-5 | V | 3/2 | 192 | 12 | |||
128-6 | VI | 5/3 | 213.33 | 13.3333 | |||
128-7 | VII | 15/8 | 240 | 15 | |||
256-1 | I | 1/1 | 256 | 16 | |||
256-2 | II | 9/8 | 288 | 18 | |||
256-3 | III | 5/4 | 320 | 20 | |||
256-4 | IV | 4/3 | 341.33 | 21.3333 | |||
256-5 | V | 3/2 | 384 | 24 | |||
256-6 | VI | 5/3 | 426.67 | 26.6667 | |||
256-7 | VII | 15/8 | 480 | 30 | |||
512-1 | I | 1/1 | 512 | 32 | |||
512-2 | II | 9/8 | 576 | 36 | |||
512-3 | III | 5/4 | 640 | 40 | |||
512-4 | IV | 4/3 | 682.67 | 42.6667 | |||
512-5 | V | 3/2 | 768 | 48 | |||
512-6 | VI | 5/3 | 853.33 | 53.3333 | |||
512-7 | VII | 15/8 | 960 | 60 | |||
1024-1 | I | 1/1 | 1,024 | 64 |
: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:
- Base: the size of the first tonic (4 px by default).
- Scale: major or minor.
- Range: up to which octave it goes.
- Rounding: exact, to the half pixel or to the pixel.
- 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.
- Prefix: the variable name (
sizeby 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.