타입 스케일

Type scale

본문 크기를 기준으로 일정한 비율(1.2, 1.25, 1.333…)을 곱해 제목 크기들을 순서대로 만드는 체계.

다른 이름: 모듈러 스케일Modular scale
···
html
<div class="stage" id="stage"></div>
css
#stage{display:grid;gap:4px;width:min(94%,500px)}
.step{display:flex;align-items:baseline;gap:12px;padding:4px 8px;border-radius:8px;transition:background .3s}
.step.active{background:color-mix(in srgb, var(--accent) 14%, transparent)}
.px{width:34px;flex:none;font:10px ui-monospace,Menlo,monospace;color:var(--muted);text-align:right}
.sample{color:var(--fg);font-weight:700;line-height:1.1;font-family:system-ui,-apple-system,sans-serif;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.step.active .sample{color:var(--accent)}
js
const base = 16, ratio = 1.25;
const steps = [3, 2, 1, 0, -1].map(function(n){ return Math.round(base * Math.pow(ratio, n)); });
const stage = document.getElementById('stage');
steps.forEach(function(px){
  const row = document.createElement('div');
  row.className = 'step';
  const pxSpan = document.createElement('span');
  pxSpan.className = 'px';
  pxSpan.textContent = px;
  const sample = document.createElement('span');
  sample.className = 'sample';
  sample.style.fontSize = px + 'px';
  sample.textContent = 'Aa 타입 스케일';
  row.appendChild(pxSpan);
  row.appendChild(sample);
  stage.appendChild(row);
});
const rows = [...stage.children];
let idx = 0;
setInterval(function(){
  rows.forEach(function(r){ r.classList.remove('active'); });
  rows[idx].classList.add('active');
  idx = (idx + 1) % rows.length;
}, 650);

크기를 감(feel)으로 정하면 `14px, 18px, 22px, 30px`처럼 제각각인 값이 쌓이기 쉽습니다. 타입 스케일은 기준 크기(보통 본문 16px)에 비율을 거듭제곱해 `16, 20, 25, 31, 39…`처럼 모든 크기가 하나의 규칙에서 나오게 합니다.

자주 쓰는 비율은 Minor Third(1.2), Major Third(1.25), Perfect Fourth(1.333), Golden Ratio(1.618)입니다. 비율이 클수록 제목과 본문의 크기 차이가 극적이고, 작을수록 위계가 촘촘해집니다.

CSS에서는 `clamp()`와 함께 쓰면 뷰포트에 따라 비율은 유지한 채 전체 스케일만 부드럽게 커지고 작아지게 만들 수 있습니다(아래 "플루이드 타이포그래피" 참고).

언제 쓰나

디자인 시스템의 타이포 토큰을 처음 정할 때. 비율 하나만 고르면 h1~caption까지 크기 논쟁이 사라집니다.