탐색

v2.1.0
타이포그래피

제목

페이지의 기본 글자색으로 표시하는 제목과 제목 위 안내 문구, 아래 소개 문단입니다.

이 페이지의 내용

제목은 페이지의 기본 글자색으로 표시합니다. 크기에 관계없이 중간 굵기 중에서도 가벼운 쪽을 사용하며, 굵기 대신 크기와 색으로 위계를 드러냅니다. 줄 길이를 고르게 맞춰 마지막 줄에 단어 하나만 남지 않게 하고, 제목이 커질수록 자간을 좁힙니다. 어떤 제목 요소에든 .heading을 적용할 수 있습니다. 클래스는 모양을, 요소는 제목 수준을 결정합니다.

제목

<header class="flex flex-col gap-sm max-w(520)">  <p class="eyebrow">Changelog</p>  <h1 class="heading heading-2xl">Faster cold builds, and comments on previews</h1>  <p class="lead">    Dependency caches are restored before the install step, and anyone can leave a note on a preview, pinned to the element they clicked.  </p></header>
<header className="flex flex-col gap-sm max-w(520)">  <p className="eyebrow">Changelog</p>  <h1 className="heading heading-2xl">Faster cold builds, and comments on previews</h1>  <p className="lead">    Dependency caches are restored before the install step, and anyone can leave a note on a preview, pinned to the element they clicked.  </p></header>
<header class="flex flex-col gap-sm max-w(520)">  <p class="eyebrow">Changelog</p>  <h1 class="heading heading-2xl">Faster cold builds, and comments on previews</h1>  <p class="lead">    Dependency caches are restored before the install step, and anyone can leave a note on a preview, pinned to the element they clicked.  </p></header>
<template>  <header class="flex flex-col gap-sm max-w(520)">    <p class="eyebrow">Changelog</p>    <h1 class="heading heading-2xl">Faster cold builds, and comments on previews</h1>    <p class="lead">      Dependency caches are restored before the install step, and anyone can leave a note on a preview, pinned to the element they clicked.    </p>  </header></template>

제목에 곁들이는 요소가 두 가지 있습니다. eyebrow는 제목 위에서 이어질 내용의 유형을 짧게 알려 주는 문구입니다. lead는 제목 아래에 놓이며 글자 크기가 본문보다 한 단계 큰 문단입니다.

#크기

크기는 일곱 가지이며, 이름은 다른 크기 단계와 같은 규칙을 따릅니다. 크기는 페이지에서 제목이 놓이는 위치에 맞춰 고르고, 요소는 문서 구조의 제목 수준에 맞춰 고르세요. 같은 <h2> 요소에도 카드에서는 heading-sm을, 섹션 맨 위에서는 heading-2xl을 적용할 수 있습니다.

크기

<div class="flex flex-col gap-md w-full">  <p class="heading heading-display">Display</p>  <p class="heading heading-2xl">Two extra large</p>  <p class="heading heading-xl">Extra large</p>  <p class="heading heading-lg">Large</p>  <p class="heading">Medium, the default</p>  <p class="heading heading-sm">Small</p>  <p class="heading heading-xs">Extra small</p></div>
<div className="flex flex-col gap-md w-full">  <p className="heading heading-display">Display</p>  <p className="heading heading-2xl">Two extra large</p>  <p className="heading heading-xl">Extra large</p>  <p className="heading heading-lg">Large</p>  <p className="heading">Medium, the default</p>  <p className="heading heading-sm">Small</p>  <p className="heading heading-xs">Extra small</p></div>
<div class="flex flex-col gap-md w-full">  <p class="heading heading-display">Display</p>  <p class="heading heading-2xl">Two extra large</p>  <p class="heading heading-xl">Extra large</p>  <p class="heading heading-lg">Large</p>  <p class="heading">Medium, the default</p>  <p class="heading heading-sm">Small</p>  <p class="heading heading-xs">Extra small</p></div>
<template>  <div class="flex flex-col gap-md w-full">    <p class="heading heading-display">Display</p>    <p class="heading heading-2xl">Two extra large</p>    <p class="heading heading-xl">Extra large</p>    <p class="heading heading-lg">Large</p>    <p class="heading">Medium, the default</p>    <p class="heading heading-sm">Small</p>    <p class="heading heading-xs">Extra small</p>  </div></template>
클래스크기용도
heading-display2.5~4.25rem랜딩 페이지의 유일한 대표 제목
heading-2xl2~2.5rem페이지 제목, 랜딩 페이지의 섹션 제목
heading-xl1.625~2rem애플리케이션 내 페이지 제목
heading-lg1.5rem섹션 제목
heading1.25rem하위 섹션 제목, 대화 상자 크기 패널의 제목
heading-sm1.0625rem카드 또는 바의 제목
heading-xs0.9375rem링크 그룹 또는 밀도 높은 패널의 제목

#너비에 따른 크기 조절

가장 큰 세 가지 크기는 컨테이너 단위로 지정합니다. 가장 가까운 크기 컨테이너를 기준으로 삼고, 크기 컨테이너가 없으면 뷰포트를 기준으로 삼습니다. 디스플레이 제목은 휴대전화의 좁은 열에서 2.5rem, 넓은 열에서 4.25rem이며, 그 사이에서는 중단점 없이 너비에 따라 연속적으로 변합니다.

너비에 따른 크기 조절

<section class="container-inline p-xl bg-surface-base">  <h1 class="heading heading-display">Every push gets an address.</h1>  <p class="lead mt-md max-w(480)">    Choose Tablet, then Phone: the title is set smaller as its container narrows, and its lines are balanced again at each size.  </p></section>
<section className="container-inline p-xl bg-surface-base">  <h1 className="heading heading-display">Every push gets an address.</h1>  <p className="lead mt-md max-w(480)">    Choose Tablet, then Phone: the title is set smaller as its container narrows, and its lines are balanced again at each size.  </p></section>
<section class="container-inline p-xl bg-surface-base">  <h1 class="heading heading-display">Every push gets an address.</h1>  <p class="lead mt-md max-w(480)">    Choose Tablet, then Phone: the title is set smaller as its container narrows, and its lines are balanced again at each size.  </p></section>
<template>  <section class="container-inline p-xl bg-surface-base">    <h1 class="heading heading-display">Every push gets an address.</h1>    <p class="lead mt-md max-w(480)">      Choose Tablet, then Phone: the title is set smaller as its container narrows, and its lines are balanced again at each size.    </p>  </section></template>

제목 크기를 패널 너비에 맞추려면 패널에 container-inline을 적용해 크기 컨테이너로 만드세요.

#줄 길이 균형

제목은 text-wrap: balance로 줄을 바꿉니다. 브라우저가 각 줄을 끝까지 채우는 대신 줄 길이를 고르게 맞추므로 두 줄 제목의 각 줄 길이가 비슷해집니다. 제목 아래 소개 문단은 text-wrap: pretty로 줄을 바꿔 마지막 줄에 단어 하나만 남는 것을 방지합니다. 브라우저가 두 방식 모두 지원하지 않으면 일반적인 방식으로 줄을 바꿉니다.

제목을 넓은 열에 배치할 때는 max-w(560)처럼 줄 너비를 제한하는 값을 지정하세요. 줄 길이 균형은 각 줄의 길이를 고르게 맞추는 동작이며, 줄 수를 결정하지는 않습니다.

#제목 위 안내 문구와 소개 문단

제목 위 안내 문구와 소개 문단

<div class="flex flex-col gap-lg max-w(520)">  <div class="flex flex-col gap-xs">    <p class="eyebrow">Pricing</p>    <h2 class="heading heading-xl">Free to start. Fair when you grow.</h2>  </div>  <p class="lead lead-sm">A small lead, for a card or a narrow column.</p>  <p class="lead">The default lead, under a page's title.</p>  <p class="lead lead-lg">A large lead, under a display heading.</p></div>
<div className="flex flex-col gap-lg max-w(520)">  <div className="flex flex-col gap-xs">    <p className="eyebrow">Pricing</p>    <h2 className="heading heading-xl">Free to start. Fair when you grow.</h2>  </div>  <p className="lead lead-sm">A small lead, for a card or a narrow column.</p>  <p className="lead">The default lead, under a page's title.</p>  <p className="lead lead-lg">A large lead, under a display heading.</p></div>
<div class="flex flex-col gap-lg max-w(520)">  <div class="flex flex-col gap-xs">    <p class="eyebrow">Pricing</p>    <h2 class="heading heading-xl">Free to start. Fair when you grow.</h2>  </div>  <p class="lead lead-sm">A small lead, for a card or a narrow column.</p>  <p class="lead">The default lead, under a page's title.</p>  <p class="lead lead-lg">A large lead, under a display heading.</p></div>
<template>  <div class="flex flex-col gap-lg max-w(520)">    <div class="flex flex-col gap-xs">      <p class="eyebrow">Pricing</p>      <h2 class="heading heading-xl">Free to start. Fair when you grow.</h2>    </div>    <p class="lead lead-sm">A small lead, for a card or a narrow column.</p>    <p class="lead">The default lead, under a page's title.</p>    <p class="lead lead-lg">A large lead, under a display heading.</p>  </div></template>

#접근성

  • 클래스만 적용해서는 요소가 제목이 되지 않습니다. <h1>부터 <h6>까지 수준을 건너뛰지 않고 순서대로 사용하고, 각 제목은 배치에 맞는 크기로 스타일을 지정하세요.
  • 페이지마다 <h1> 요소를 하나만 사용하세요.
  • 제목 위 안내 문구에는 <p> 요소를 사용하세요. 안내 문구는 제목보다 먼저 읽히는 것이 맞지만, 제목 요소로 지정하면 안 됩니다. 제목 목록은 실제 제목부터 시작해야 합니다.
  • 제목은 모든 표면에서 대비가 높은 글자색으로 표시합니다. 색을 반전한 표면에서는 fg-text-inverse 클래스를 추가하세요.

#클래스

클래스설명
heading1.25rem 제목. 진한 글자색과 다소 가벼운 중간 굵기를 적용하고 줄 길이의 균형을 맞춥니다.
heading-xs링크 그룹이나 항목이 빽빽한 패널에 쓰는 0.9375rem적용할 클래스는 heading입니다
heading-sm카드나 바에 쓰는 1.0625rem적용할 클래스는 heading입니다
heading-lg섹션에 쓰는 1.5rem적용할 클래스는 heading입니다
heading-xl앱의 페이지 제목에 쓰며, 컨테이너 너비에 따라 1.625rem에서 2rem까지 달라집니다.적용할 클래스는 heading입니다
heading-2xl페이지 제목이나 랜딩 페이지의 섹션에 쓰며, 컨테이너 너비에 따라 2rem에서 2.5rem까지 달라집니다.적용할 클래스는 heading입니다
heading-display랜딩 페이지의 대표 제목 하나에 쓰며, 컨테이너 너비에 따라 2.5rem에서 4.25rem까지 달라집니다.적용할 클래스는 heading입니다
eyebrow제목 위에 대문자로 짧게 표시해 이어지는 내용의 종류를 알려 주는 문구입니다. 제목 요소 대신 p를 사용합니다
lead제목 아래 문단은 1.125rem 크기로 표시하며, 마지막 줄에 단어 하나만 남지 않도록 줄바꿈합니다
lead-sm카드나 좁은 열에 쓰는 1rem적용할 클래스는 lead입니다
lead-lg디스플레이 제목 아래에 쓰는 1.25rem적용할 클래스는 lead입니다

#사용자 지정 속성

속성기본값설명
--heading-size1.25rem글꼴 크기
--heading-leading1.3줄 높이
--heading-tracking-.012em자간

#소스

@master/ui/components/heading.css
/* * Heading: a title, the short line over it and the paragraph under it. * A heading is set in the ink of the page at a light medium weight: size and ink carry the hierarchy, not * boldness. Its lines are balanced, so a title never leaves one word alone on the last line, and its Latin * tracking tightens as it grows; Chinese, Japanese and Korean keep their own spacing. The three largest sizes follow the room they are given: they are sized in container * units, which measure the nearest size container and, where there is none, the viewport. */@layer components.ui {  .heading {    --heading-size: 1.25rem;    --heading-leading: 1.3;    --heading-tracking: -.012em;    margin: 0;    color: var(--color-text-strong);    font: var(--font-weight-control) var(--heading-size)/var(--heading-leading) var(--font-family-sans);    font-feature-settings: inherit;    letter-spacing: var(--heading-tracking);    text-wrap: balance;    overflow-wrap: anywhere;    &.heading-xs {      --heading-size: .9375rem;      --heading-leading: 1.4;      --heading-tracking: -.004em;    }    &.heading-sm {      --heading-size: 1.0625rem;      --heading-leading: 1.35;      --heading-tracking: -.008em;    }    &.heading-lg {      --heading-size: 1.5rem;      --heading-leading: 1.25;      --heading-tracking: -.018em;    }    &.heading-xl {      --heading-size: clamp(1.625rem, 1.3rem + 1.6cqi, 2rem);      --heading-leading: 1.18;      --heading-tracking: -.024em;    }    &.heading-2xl {      --heading-size: clamp(2rem, 1.4rem + 2.6cqi, 2.5rem);      --heading-leading: 1.12;      --heading-tracking: -.03em;    }    /* Display: the one title of a page, from 2.5rem in a phone's column to 4.25rem in a wide one. */    &.heading-display {      --heading-size: clamp(2.5rem, 1.5rem + 4.4cqi, 4.25rem);      --heading-leading: 1.04;      --heading-tracking: -.038em;    }    /*     * Han, kana and Hangul keep their own spacing at every size: tracking that tightens Latin as it grows would     * crowd square glyphs. It follows the content's language, so a CJK title in an English page is spaced too.     */    &:is(:lang(zh), :lang(ja), :lang(ko)) {      --heading-tracking: 0em;    }  }  /* Eyebrow: the few words over a heading that say what kind of thing follows. */  .eyebrow {    margin: 0;    color: var(--color-text-muted);    font: var(--font-weight-control) .75rem/1.4 var(--font-family-sans);    font-feature-settings: inherit;    letter-spacing: .06em;    text-transform: uppercase;    /* A long word in capitals, spaced out, breaks rather than run out of a narrow card. */    overflow-wrap: break-word;    /* The spacing is for Latin capitals; scripts without case are set as they are. */    &:is(:lang(zh), :lang(ja), :lang(ko)) {      letter-spacing: 0;    }  }  /* Lead: the paragraph under a heading, a step larger than body text and wrapped without orphans. */  .lead {    margin: 0;    color: var(--color-text-body);    font-size: 1.125rem;    line-height: 1.6;    text-wrap: pretty;    /* A long address or name breaks rather than run out of the column. */    overflow-wrap: break-word;    &.lead-sm {      font-size: 1rem;    }    &.lead-lg {      font-size: 1.25rem;      line-height: 1.5;      letter-spacing: -.006em;      &:is(:lang(zh), :lang(ja), :lang(ko)) {        letter-spacing: 0;      }    }  }}