본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

타이포그래피

원문 보기 위키 갱신

타이포그래피 (Typography)

Primer가 제공하는 모든 타이포그래피 관련 CSS 변수 개요입니다. 폰트 패밀리, font shorthand, display·title·body·caption·code 등의 텍스트 스타일, 그리고 font-weight·font-size·line-height의 base 토큰을 한곳에 모아 정리합니다.

출처: 문서

본문

이 페이지는 사용 가능한 타이포그래피 CSS 변수를 항목별로 나열한 참조입니다. 각 변수는 CSS에서 바로 사용할 수 있고, 출력값은 브라우저에 실제 적용되는 값이며, 소스 값은 디자인 토큰 기반의 원본 정의입니다.

Font family

폰트 스택 관련 변수입니다. --fontStack-sansSerif, --fontStack-sansSerifDisplay, --fontStack-system는 동일한 Mona Sans 기반 스택을, --fontStack-monospace는 모노스페이스 스택을 제공합니다.

--fontStack-monospace: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace
--fontStack-sansSerif: 'Mona Sans VF', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans Backtick Fix', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'
--fontStack-sansSerifDisplay: 'Mona Sans VF', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans Backtick Fix', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'
--fontStack-system: 'Mona Sans VF', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans Backtick Fix', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'

Font shorthand

font 선언을 사용하면 모든 폰트 속성(font-weight, font-size, line-height, font-family)을 한 번에 설정할 수 있습니다.

font: var(--text-display-shorthand);

각 텍스트 스타일 규격은 다음과 같습니다.

--text-body-shorthand-small: font-weight {text.body.weight} / font-size {text.body.size.small} / font-family {fontStack.sansSerif} / line-height {text.body.lineHeight.small}
--text-body-shorthand-medium: font-weight {text.body.weight} / font-size {text.body.size.medium} / font-family {fontStack.sansSerif} / line-height {text.body.lineHeight.medium}
--text-body-shorthand-large: font-weight {text.body.weight} / font-size {text.body.size.large} / font-family {fontStack.sansSerif} / line-height {text.body.lineHeight.large}
--text-caption-shorthand: font-weight {text.caption.weight} / font-size {text.caption.size} / font-family {fontStack.sansSerif} / line-height {text.caption.lineHeight}
--text-codeBlock-shorthand: font-weight {text.codeBlock.weight} / font-size {text.codeBlock.size} / font-family {fontStack.monospace} / line-height {text.codeBlock.lineHeight}
--text-codeInline-shorthand: font-weight {text.codeInline.weight} / font-size {text.codeInline.size} / font-family {fontStack.monospace}
--text-display-shorthand: font-weight {text.display.weight} / font-size {text.display.size} / font-family {fontStack.sansSerifDisplay} / line-height {text.display.lineHeight}
--text-subtitle-shorthand: font-weight {text.subtitle.weight} / font-size {text.subtitle.size} / font-family {fontStack.sansSerifDisplay} / line-height {text.subtitle.lineHeight}
--text-title-shorthand-small: font-weight {text.title.weight.small} / font-size {text.title.size.small} / font-family {fontStack.sansSerif} / line-height {text.title.lineHeight.small}
--text-title-shorthand-medium: font-weight {text.title.weight.medium} / font-size {text.title.size.medium} / font-family {fontStack.sansSerifDisplay} / line-height {text.title.lineHeight.medium}
--text-title-shorthand-large: font-weight {text.title.weight.large} / font-size {text.title.size.large} / font-family {fontStack.sansSerifDisplay} / line-height {text.title.lineHeight.large}

Display

--text-display-lineHeight: 1.375 / {base.text.lineHeight.snug}
--text-display-size: 2.5rem / {base.text.size.2xl}
--text-display-weight: 500 / {base.text.weight.medium}

Title large

--text-title-lineHeight-large: 1.5 / {base.text.lineHeight.normal}
--text-title-size-large: 2rem / {base.text.size.xl}
--text-title-weight-large: 600 / {base.text.weight.semibold}

Title medium

--text-title-lineHeight-medium: 1.625 / {base.text.lineHeight.relaxed}
--text-title-size-medium: 1.25rem / {base.text.size.lg}
--text-title-weight-medium: 600 / {base.text.weight.semibold}

Title small

--text-title-lineHeight-small: 1.5 / {base.text.lineHeight.normal}
--text-title-size-small: 1rem / {base.text.size.md}
--text-title-weight-small: 600 / {base.text.weight.semibold}

Subtitle

--text-subtitle-lineHeight: 1.625 / {base.text.lineHeight.relaxed}
--text-subtitle-size: 1.25rem / {base.text.size.lg}
--text-subtitle-weight: 400 / {base.text.weight.normal}

Body large

--text-body-lineHeight-large: 1.5 / {base.text.lineHeight.normal}
--text-body-size-large: 1rem / {base.text.size.md}

Body medium

--text-body-lineHeight-medium: 1.5 / {base.text.lineHeight.normal}
--text-body-size-medium: 0.875rem / {base.text.size.sm}

Body small

--text-body-lineHeight-small: 1.625 / {base.text.lineHeight.relaxed}
--text-body-size-small: 0.75rem / {base.text.size.xs}

Caption

--text-caption-lineHeight: 1.25 / {base.text.lineHeight.tight}
--text-caption-size: 0.75rem / {base.text.size.xs}
--text-caption-weight: 400 / {base.text.weight.normal}

Code block

--text-codeBlock-lineHeight: 1.5 / {base.text.lineHeight.normal}
--text-codeBlock-size: 0.8125rem / 13px
--text-codeBlock-weight: 400 / {base.text.weight.normal}

Inline code block

--text-codeInline-size: 0.9285em / 0.9285em
--text-codeInline-weight: 400 / {base.text.weight.normal}

Weight

가능하면 font shorthand 토큰이나 텍스트 스타일의 개별 토큰을 사용하는 것을 선호합니다.

--base-text-weight-light: 300 / 300
--base-text-weight-normal: 400 / 400
--base-text-weight-medium: 500 / 500
--base-text-weight-semibold: 600 / 600

Font size

--base-text-size-xs: 0.75rem / 0.75rem
--base-text-size-sm: 0.875rem / 0.875rem
--base-text-size-md: 1rem / 1rem
--base-text-size-lg: 1.25rem / 1.25rem
--base-text-size-xl: 2rem / 2rem
--base-text-size-2xl: 2.5rem / 2.5rem

Line height

--base-text-lineHeight-tight: 1.25 / 1.25
--base-text-lineHeight-snug: 1.375 / 1.375
--base-text-lineHeight-normal: 1.5 / 1.5
--base-text-lineHeight-relaxed: 1.625 / 1.625
--base-text-lineHeight-loose: 1.75 / 1.75

더 알아보기 (Learn more)