typography-system

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Typography System

排版系统

Overview

概述

Typography is the voice of your interface. It communicates hierarchy, establishes tone, and guides users through your content. Great typography is invisible—users don't notice it because it works so well.
This skill teaches you to think about typography systematically: choosing fonts with intention, creating scales that feel natural, establishing clear hierarchy, and ensuring readability and accessibility across all contexts.
排版是界面的“声音”,它传递层级、确立风格基调,并引导用户浏览内容。优秀的排版是“无形的”——用户不会注意到它,因为它的表现恰到好处。
本技能将教会你系统性地思考排版:有目的地选择字体、构建自然协调的字阶、建立清晰的层级结构,并确保在所有场景下的可读性与无障碍适配。

Core Methodology: Type Scales and Hierarchy

核心方法:字阶与层级

Rather than choosing font sizes arbitrarily, use a modular scale—a mathematical progression of sizes that feels harmonious and intentional.
不要随意选择字号,而是使用模块化字阶——一种基于数学比例的字号序列,能带来协调且有目的性的视觉效果。

Modular Scales

模块化字阶

A modular scale is a sequence of sizes derived from a base size and a ratio. Common ratios:
RatioNameUse CaseExample (16px base)
1.125Major SecondSubtle, minimal16, 18, 20, 23, 26, 29, 33, 37, 42, 47
1.25Major ThirdBalanced, harmonious16, 20, 25, 31, 39, 49, 61, 76, 95
1.5Perfect FifthBold, dramatic16, 24, 36, 54, 81, 122
1.618Golden RatioNatural, elegant16, 26, 42, 68, 110
Choosing a Scale:
  • 1.125 (Major Second) — For subtle, minimal designs
  • 1.25 (Major Third) — For balanced, harmonious designs (most common)
  • 1.5 (Perfect Fifth) — For bold, dramatic designs
  • 1.618 (Golden Ratio) — For natural, elegant designs
Example: Major Third Scale (1.25 ratio)
Base: 16px
Scale: 16, 20, 25, 31, 39, 49, 61, 76, 95

Practical sizes:
- Caption: 12px (smaller than base)
- Body: 16px (base)
- Body Large: 18px (between base and next)
- Heading 6: 20px
- Heading 5: 25px
- Heading 4: 31px
- Heading 3: 39px
- Heading 2: 49px
- Heading 1: 61px
- Display: 76px (for hero sections)
模块化字阶是由基础字号和比例推导出来的字号序列。常见比例:
比例名称适用场景示例(基础字号16px)
1.125大二度简约、低调风格16, 18, 20, 23, 26, 29, 33, 37, 42, 47
1.25大三度平衡、协调风格16, 20, 25, 31, 39, 49, 61, 76, 95
1.5纯五度醒目、戏剧性风格16, 24, 36, 54, 81, 122
1.618黄金比例自然、优雅风格16, 26, 42, 68, 110
字阶选择建议:
  • 1.125(大二度) — 适用于简约、低调的设计
  • 1.25(大三度) — 适用于平衡、协调的设计(最常用)
  • 1.5(纯五度) — 适用于醒目、戏剧性的设计
  • 1.618(黄金比例) — 适用于自然、优雅的设计
示例:大三度字阶(比例1.25)
基础字号: 16px
字阶序列: 16, 20, 25, 31, 39, 49, 61, 76, 95

实用字号分配:
- 说明文字: 12px(小于基础字号)
- 正文: 16px(基础字号)
- 大正文: 18px(基础字号与下一级之间)
- 六级标题: 20px
- 五级标题: 25px
- 四级标题: 31px
- 三级标题: 39px
- 二级标题: 49px
- 一级标题: 61px
- 展示级标题: 76px(用于 hero 区域)

Implementing Type Scales in Tailwind

在 Tailwind 中实现模块化字阶

javascript
module.exports = {
  theme: {
    fontSize: {
      // Captions and small text
      'xs': ['12px', { lineHeight: '1.5' }],
      'sm': ['14px', { lineHeight: '1.5' }],
      
      // Body text
      'base': ['16px', { lineHeight: '1.6' }],
      'lg': ['18px', { lineHeight: '1.6' }],
      
      // Headings (modular scale 1.25)
      'h6': ['20px', { lineHeight: '1.3', fontWeight: '600' }],
      'h5': ['25px', { lineHeight: '1.3', fontWeight: '600' }],
      'h4': ['31px', { lineHeight: '1.2', fontWeight: '700' }],
      'h3': ['39px', { lineHeight: '1.2', fontWeight: '700' }],
      'h2': ['49px', { lineHeight: '1.1', fontWeight: '700' }],
      'h1': ['61px', { lineHeight: '1.1', fontWeight: '700' }],
      
      // Display (for hero sections)
      'display': ['76px', { lineHeight: '1', fontWeight: '800' }],
    },
  },
};
javascript
module.exports = {
  theme: {
    fontSize: {
      // 说明文字与小号文本
      'xs': ['12px', { lineHeight: '1.5' }],
      'sm': ['14px', { lineHeight: '1.5' }],
      
      // 正文文本
      'base': ['16px', { lineHeight: '1.6' }],
      'lg': ['18px', { lineHeight: '1.6' }],
      
      // 标题(模块化字阶比例1.25)
      'h6': ['20px', { lineHeight: '1.3', fontWeight: '600' }],
      'h5': ['25px', { lineHeight: '1.3', fontWeight: '600' }],
      'h4': ['31px', { lineHeight: '1.2', fontWeight: '700' }],
      'h3': ['39px', { lineHeight: '1.2', fontWeight: '700' }],
      'h2': ['49px', { lineHeight: '1.1', fontWeight: '700' }],
      'h1': ['61px', { lineHeight: '1.1', fontWeight: '700' }],
      
      // 展示级标题(用于 hero 区域)
      'display': ['76px', { lineHeight: '1', fontWeight: '800' }],
    },
  },
};

Font Selection

字体选择

Choosing Fonts

选字原则

Font Pairing Principles:
  1. Contrast — Pair fonts with different characteristics (serif + sans-serif, or geometric + humanist)
  2. Personality Match — Fonts should match your brand personality
  3. Readability — Prioritize readability over style
  4. Versatility — Fonts should work across sizes and weights
字体搭配原则:
  1. 对比性 — 搭配具有不同特征的字体(衬线+无衬线,或几何风格+人文风格)
  2. 风格匹配 — 字体需契合品牌调性
  3. 可读性 — 优先考虑可读性而非风格
  4. 通用性 — 字体需适配不同字号与字重

Common Font Pairings

常见字体搭配方案

Heading FontBody FontPersonalityUse Case
Playfair DisplayInterElegant, sophisticatedLuxury, editorial
MontserratOpen SansModern, geometricTech, SaaS
MerriweatherLatoWarm, friendlyPublishing, lifestyle
Space MonoSpace GroteskFuturistic, technicalDeveloper tools, tech
PoppinsPoppinsContemporary, friendlyStartups, consumer apps
标题字体正文字体风格调性适用场景
Playfair DisplayInter优雅、精致奢侈品、编辑类内容
MontserratOpen Sans现代、几何感科技、SaaS产品
MerriweatherLato温暖、友好出版、生活方式类产品
Space MonoSpace Grotesk未来感、技术向开发者工具、科技产品
PoppinsPoppins现代、亲切初创产品、消费级应用

Font Loading Strategy

字体加载策略

Use system fonts first, then web fonts as fallback:
css
/* System fonts (fast, no network request) */
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

/* Or use web fonts (Google Fonts, Typekit, etc.) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

body {
  font-family: 'Inter', system-ui, sans-serif;
}
Font Loading Best Practices:
  • Use
    font-display: swap
    to avoid invisible text while fonts load
  • Preload critical fonts:
    <link rel="preload" as="font" href="font.woff2" crossorigin>
  • Limit to 2-3 font families and 3-4 weights
  • Use variable fonts to reduce file size
优先使用系统字体,再以网络字体作为备选:
css
/* 系统字体(加载快,无需网络请求) */
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

/* 或使用网络字体(Google Fonts、Typekit等) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

body {
  font-family: 'Inter', system-ui, sans-serif;
}
字体加载最佳实践:
  • 使用
    font-display: swap
    避免字体加载时出现空白文本
  • 预加载关键字体:
    <link rel="preload" as="font" href="font.woff2" crossorigin>
  • 限制字体家族数量为2-3种,字重为3-4种
  • 使用可变字体减少文件体积

Hierarchy and Emphasis

层级与强调

Creating Visual Hierarchy

构建视觉层级

Use these properties to create hierarchy:
  1. Size — Larger text is more prominent
  2. Weight — Bolder text is more prominent
  3. Color — Brighter or more saturated colors are more prominent
  4. Spacing — More space around text makes it more prominent
  5. Position — Top-left is more prominent than bottom-right
Example: Hierarchy in a Card
html
<div class="card">
  <h2 class="card-title">Card Title</h2>
  <p class="card-description">This is a description of the card content.</p>
  <p class="card-meta">Published on January 16, 2026</p>
</div>
css
.card-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.card-description {
  font-size: 16px;
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.card-meta {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.5;
}
通过以下属性构建层级:
  1. 字号 — 字号越大越突出
  2. 字重 — 字重越粗越突出
  3. 颜色 — 亮度或饱和度越高越突出
  4. 间距 — 周围空间越多越突出
  5. 位置 — 左上区域比右下区域更突出
示例:卡片中的层级设计
html
<div class="card">
  <h2 class="card-title">卡片标题</h2>
  <p class="card-description">这是卡片内容的描述文本。</p>
  <p class="card-meta">发布于2026年1月16日</p>
</div>
css
.card-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.card-description {
  font-size: 16px;
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.card-meta {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.5;
}

Emphasis Techniques

文本强调技巧

  • Bold — Use for emphasis, not entire paragraphs
  • Italic — Use for citations, asides, or emphasis
  • Color — Use to highlight important information
  • ALL CAPS — Use sparingly for labels or buttons
  • Underline — Use only for links (to avoid confusion)
  • 加粗 — 用于强调局部内容,而非整段文本
  • 斜体 — 用于引用、附注或强调
  • 颜色 — 用于高亮重要信息
  • 全大写 — 谨慎使用,仅适用于标签或按钮文本
  • 下划线 — 仅用于链接(避免造成混淆)

Readability and Accessibility

可读性与无障碍适配

Line Height

行高

Line height affects readability. Tighter line heights for headings, looser for body text:
css
h1, h2, h3 {
  line-height: 1.2; /* Tight for headings */
}

p, li {
  line-height: 1.6; /* Loose for body text */
}

.caption {
  line-height: 1.4; /* Medium for captions */
}
行高影响可读性,标题使用紧凑行高,正文使用宽松行高:
css
h1, h2, h3 {
  line-height: 1.2; /* 标题行高紧凑 */
}

p, li {
  line-height: 1.6; /* 正文行高宽松 */
}

.caption {
  line-height: 1.4; /* 说明文字行高中等 */
}

Line Length

行长度

Optimal line length is 50-75 characters. Too long and reading becomes difficult:
css
main {
  max-width: 65ch; /* ~65 characters */
}
最优行长度为50-75个字符,过长会增加阅读难度:
css
main {
  max-width: 65ch; /* 约65个字符 */
}

Letter Spacing

字间距

Adjust letter spacing for different contexts:
css
h1 {
  letter-spacing: -0.02em; /* Tighter for large headings */
}

.label {
  letter-spacing: 0.05em; /* Looser for labels */
}

.caption {
  letter-spacing: 0; /* Normal for body text */
}
根据不同场景调整字间距:
css
h1 {
  letter-spacing: -0.02em; /* 大标题字间距收紧 */
}

.label {
  letter-spacing: 0.05em; /* 标签字间距放宽 */
}

.caption {
  letter-spacing: 0; /* 正文字间距正常 */
}

Text Contrast

文本对比度

Ensure sufficient contrast for readability (WCAG AA: 4.5:1 for normal text, 3:1 for large text):
css
/* Good contrast */
color: #030712; /* dark text */
background-color: #F9FAFB; /* light background */
/* Contrast ratio: 19:1 ✓ */

/* Poor contrast */
color: #9CA3AF; /* medium gray text */
background-color: #F9FAFB; /* light background */
/* Contrast ratio: 2.5:1 ✗ */
确保足够的对比度以保证可读性(WCAG AA标准:普通文本对比度4.5:1,大文本3:1):
css
/* 良好对比度 */
color: #030712; /* 深色文本 */
background-color: #F9FAFB; /* 浅色背景 */
/* 对比度:19:1 ✓ */

/* 较差对比度 */
color: #9CA3AF; /* 中度灰色文本 */
background-color: #F9FAFB; /* 浅色背景 */
/* 对比度:2.5:1 ✗ */

Responsive Typography

响应式排版

Use fluid typography to scale smoothly across devices:
css
/* Fixed sizes (old approach) */
h1 {
  font-size: 24px; /* mobile */
}

@media (min-width: 768px) {
  h1 {
    font-size: 32px; /* tablet */
  }
}

@media (min-width: 1024px) {
  h1 {
    font-size: 40px; /* desktop */
  }
}

/* Fluid typography (modern approach) */
h1 {
  font-size: clamp(24px, 5vw, 40px);
  /* min: 24px, preferred: 5% of viewport width, max: 40px */
}
使用流体排版实现跨设备的平滑缩放:
css
/* 固定字号(旧方案) */
h1 {
  font-size: 24px; /* 移动端 */
}

@media (min-width: 768px) {
  h1 {
    font-size: 32px; /* 平板端 */
  }
}

@media (min-width: 1024px) {
  h1 {
    font-size: 40px; /* 桌面端 */
  }
}

/* 流体排版(现代方案) */
h1 {
  font-size: clamp(24px, 5vw, 40px);
  /* 最小值:24px,首选值:视口宽度的5%,最大值:40px */
}

Advanced Typography Techniques

高级排版技巧

Variable Fonts

可变字体

Variable fonts allow multiple weights and styles in a single file:
css
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap');

body {
  font-family: 'Inter', sans-serif;
  font-weight: 400;
}

strong {
  font-weight: 600;
}

.light {
  font-weight: 300;
}
可变字体可在单个文件中包含多种字重与样式:
css
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap');

body {
  font-family: 'Inter', sans-serif;
  font-weight: 400;
}

strong {
  font-weight: 600;
}

.light {
  font-weight: 300;
}

Font Features

字体特性

Use OpenType features for advanced typography:
css
/* Ligatures (fi, fl, etc.) */
body {
  font-feature-settings: 'liga' 1;
}

/* Tabular numbers (for tables) */
.table {
  font-feature-settings: 'tnum' 1;
}

/* Small caps */
.label {
  font-feature-settings: 'smcp' 1;
}
使用OpenType特性实现高级排版效果:
css
/* 连字(fi、fl等) */
body {
  font-feature-settings: 'liga' 1;
}

/* 表格数字(用于表格) */
.table {
  font-feature-settings: 'tnum' 1;
}

/* 小型大写字母 */
.label {
  font-feature-settings: 'smcp' 1;
}

Common Typography Patterns

常见排版模式

Pattern 1: Article Typography

模式1:文章排版

css
article {
  font-size: 18px;
  line-height: 1.7;
  max-width: 65ch;
  margin: 0 auto;
  padding: 2rem 1rem;
}

article h1 {
  font-size: 49px;
  line-height: 1.1;
  margin-bottom: 1rem;
  margin-top: 2rem;
}

article h2 {
  font-size: 39px;
  line-height: 1.2;
  margin-bottom: 0.75rem;
  margin-top: 1.5rem;
}

article p {
  margin-bottom: 1.5rem;
}

article a {
  color: var(--interactive-primary);
  text-decoration: underline;
}
css
article {
  font-size: 18px;
  line-height: 1.7;
  max-width: 65ch;
  margin: 0 auto;
  padding: 2rem 1rem;
}

article h1 {
  font-size: 49px;
  line-height: 1.1;
  margin-bottom: 1rem;
  margin-top: 2rem;
}

article h2 {
  font-size: 39px;
  line-height: 1.2;
  margin-bottom: 0.75rem;
  margin-top: 1.5rem;
}

article p {
  margin-bottom: 1.5rem;
}

article a {
  color: var(--interactive-primary);
  text-decoration: underline;
}

Pattern 2: UI Typography

模式2:UI 排版

css
/* Buttons */
button {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0;
}

/* Labels */
label {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.05em;
}

/* Captions */
.caption {
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--text-secondary);
}
css
/* 按钮 */
button {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0;
}

/* 标签 */
label {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.05em;
}

/* 说明文字 */
.caption {
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--text-secondary);
}

Pattern 3: Responsive Headings

模式3:响应式标题

css
h1 {
  font-size: clamp(24px, 5vw, 61px);
  line-height: 1.1;
  font-weight: 700;
}

h2 {
  font-size: clamp(20px, 4vw, 49px);
  line-height: 1.2;
  font-weight: 700;
}

h3 {
  font-size: clamp(18px, 3vw, 39px);
  line-height: 1.2;
  font-weight: 600;
}
css
h1 {
  font-size: clamp(24px, 5vw, 61px);
  line-height: 1.1;
  font-weight: 700;
}

h2 {
  font-size: clamp(20px, 4vw, 49px);
  line-height: 1.2;
  font-weight: 700;
}

h3 {
  font-size: clamp(18px, 3vw, 39px);
  line-height: 1.2;
  font-weight: 600;
}

How to Use This Skill with Claude Code

如何结合 Claude Code 使用本技能

Create a Type Scale

创建字阶方案

"I'm using the typography-system skill. Can you create a type scale for me?
- Base font size: 16px
- Ratio: 1.25 (Major Third)
- Font family: Inter for body, Playfair Display for headings
- Include sizes for: captions, body, headings, display
- Ensure accessibility (contrast, line height, line length)"
"我正在使用排版系统技能。能否帮我创建一套字阶方案?
- 基础字号:16px
- 比例:1.25(大三度)
- 字体家族:正文用Inter,标题用Playfair Display
- 包含字号:说明文字、正文、标题、展示级标题
- 确保符合无障碍标准(对比度、行高、行长度)"

Audit Your Typography

排版审计

"Can you audit my current typography?
- Are my font sizes following a modular scale?
- Is my line height appropriate?
- Is my line length too long?
- Are my color contrasts sufficient?
- Are my fonts accessible?
- What improvements would you suggest?"
"能否帮我审计当前的排版方案?
- 字号是否遵循模块化字阶?
- 行高是否合适?
- 行长度是否过长?
- 颜色对比度是否达标?
- 字体是否符合无障碍要求?
- 有哪些改进建议?"

Implement Responsive Typography

实现响应式排版

"Can you help me implement responsive typography?
- Create fluid typography using clamp()
- Ensure readability at all breakpoints
- Test at mobile (320px), tablet (768px), desktop (1024px)
- Provide CSS code I can use"
"能否帮我实现响应式排版?
- 使用clamp()创建流体排版
- 确保所有断点下的可读性
- 在移动端(320px)、平板端(768px)、桌面端(1024px)测试
- 提供可直接使用的CSS代码"

Create Typography Documentation

创建排版文档

"Can you create comprehensive typography documentation?
- Type scale with all sizes
- Font pairings and usage
- Hierarchy guidelines
- Accessibility guidelines
- Code examples for each style
- Responsive behavior"
"能否帮我创建完整的排版文档?
- 包含所有字号的字阶表
- 字体搭配与使用规范
- 层级设计指南
- 无障碍设计指南
- 各样式的代码示例
- 响应式表现说明"

Design Critique: Evaluating Your Typography

设计评审:评估你的排版方案

Claude Code can critique your typography:
"Can you evaluate my typography?
- Is my type scale harmonious?
- Is my hierarchy clear?
- Is my readability good?
- Are my color contrasts sufficient?
- Are my fonts accessible?
- What's one thing I could improve immediately?"
Claude Code 可以对你的排版方案进行评审:
"能否帮我评估我的排版方案?
- 字阶是否协调?
- 层级是否清晰?
- 可读性是否良好?
- 颜色对比度是否达标?
- 字体是否符合无障碍要求?
- 我可以立即改进的一个点是什么?"

Integration with Other Skills

与其他技能的集成

  • design-foundation — Typography tokens and scales
  • layout-system — Responsive typography scales
  • color-system — Text color and contrast
  • component-architecture — Typography in components
  • accessibility-excellence — Font sizes, contrast, line height
  • interaction-design — Typography in animations
  • design-foundation — 排版令牌与字阶
  • layout-system — 响应式排版字阶
  • color-system — 文本颜色与对比度
  • component-architecture — 组件中的排版
  • accessibility-excellence — 字号、对比度、行高
  • interaction-design — 动画中的排版

Key Principles

核心原则

1. Type Scale Brings Harmony A modular scale feels natural and intentional. It's the foundation of great typography.
2. Hierarchy Guides Users Clear hierarchy helps users understand what's important and what to read next.
3. Readability is Non-Negotiable Beautiful typography that's hard to read is not beautiful. Readability comes first.
4. Accessibility is Foundational Font sizes, contrast, and line height must meet accessibility standards.
5. Consistency Builds Trust Consistent typography across your product builds trust and reduces cognitive load.
1. 字阶带来协调感 模块化字阶能营造自然且有目的性的视觉效果,是优秀排版的基础。
2. 层级引导用户 清晰的层级帮助用户理解内容优先级与阅读顺序。
3. 可读性是底线 美观但难以阅读的排版毫无意义,可读性永远是第一位的。
4. 无障碍是基础要求 字号、对比度与行高必须符合无障碍标准。
5. 一致性建立信任 产品中一致的排版能建立用户信任并降低认知负荷。

Checklist: Is Your Typography System Ready?

检查清单:你的排版系统是否就绪?

  • Type scale is defined and modular
  • Font families are chosen with intention
  • Font sizes are consistent across components
  • Line heights are appropriate for context
  • Line length is 50-75 characters for body text
  • Color contrast meets WCAG AA standards
  • Hierarchy is clear and intentional
  • Responsive typography uses fluid scaling
  • Fonts are loaded efficiently
  • Typography works well on all devices
  • Typography is documented and shared with the team
Great typography is the voice of your interface. Make it count.
  • 已定义模块化字阶
  • 有目的地选择了字体家族
  • 组件间字号保持一致
  • 行高适配不同场景
  • 正文行长度在50-75字符之间
  • 颜色对比度符合WCAG AA标准
  • 层级结构清晰且有目的性
  • 使用流体缩放实现响应式排版
  • 字体加载高效
  • 排版在所有设备上表现良好
  • 排版方案已文档化并共享给团队
优秀的排版是界面的“声音”,让它发挥应有的价值。",