탐색

v2.1.0
타이포그래피

인용 표시

문장 안에서 출처를 가리키는 작은 번호입니다.

이 페이지의 내용

인용 표시는 주장의 끝에 붙어 출처를 가리키는 작은 번호입니다. 칩과 같은 색조의 둥근 캡슐 모양 링크로 표시되며, 본문 글자보다 조금 작고 기준선보다 약간 높게 배치됩니다. 포인터를 올리거나 출처가 표시되는 동안에는 잉크 색으로 채워집니다.

인용 표시

<div class="max-w(480) mx-auto text-sm fg-text-body leading-md">  <p class="m(0)">    Corners are drawn as squircles where the browser has <code class="code">corner-shape</code><button type="button" class="citation" popovertarget="source-1" aria-label="Source 1">1</button><span class="popover" id="source-1" popover>      <span class="flex flex-col gap-xs">        <span class="fg-text-strong font-medium">          CSS Borders and Box Decorations Module Level 4        </span><span class="fg-text-muted text-xs">W3C Working Draft · w3.org</span>      </span>    </span> and as circles elsewhere, with the radius scaled so both look equally round.<a class="citation" href="#ref-2" aria-label="Source 2">2</a><a class="citation" href="#ref-3" aria-label="Source 3">3</a>  </p>  <ol class="mt-md pl-md text-xs fg-text-muted">    <li>CSS Borders and Box Decorations Module Level 4</li>    <li id="ref-2">Master UI theme guide, “Continuous corners”</li>    <li id="ref-3">Figma, “Desperately seeking squircles”</li>  </ol></div>
<div className="max-w(480) mx-auto text-sm fg-text-body leading-md">  <p className="m(0)">    Corners are drawn as squircles where the browser has <code className="code">corner-shape</code><button type="button" className="citation" popoverTarget="source-1" aria-label="Source 1">      1    </button><span className="popover" id="source-1" popover="">      <span className="flex flex-col gap-xs">        <span className="fg-text-strong font-medium">          CSS Borders and Box Decorations Module Level 4        </span><span className="fg-text-muted text-xs">W3C Working Draft · w3.org</span>      </span>    </span> and as circles elsewhere, with the radius scaled so both look equally round.<a className="citation" href="#ref-2" aria-label="Source 2">2</a><a className="citation" href="#ref-3" aria-label="Source 3">3</a>  </p>  <ol className="mt-md pl-md text-xs fg-text-muted">    <li>CSS Borders and Box Decorations Module Level 4</li>    <li id="ref-2">Master UI theme guide, “Continuous corners”</li>    <li id="ref-3">Figma, “Desperately seeking squircles”</li>  </ol></div>
<div class="max-w(480) mx-auto text-sm fg-text-body leading-md">  <p class="m(0)">    Corners are drawn as squircles where the browser has <code class="code">corner-shape</code><button type="button" class="citation" popovertarget="source-1" aria-label="Source 1">1</button><span class="popover" id="source-1" popover>      <span class="flex flex-col gap-xs">        <span class="fg-text-strong font-medium">          CSS Borders and Box Decorations Module Level 4        </span><span class="fg-text-muted text-xs">W3C Working Draft · w3.org</span>      </span>    </span> and as circles elsewhere, with the radius scaled so both look equally round.<a class="citation" href="#ref-2" aria-label="Source 2">2</a><a class="citation" href="#ref-3" aria-label="Source 3">3</a>  </p>  <ol class="mt-md pl-md text-xs fg-text-muted">    <li>CSS Borders and Box Decorations Module Level 4</li>    <li id="ref-2">Master UI theme guide, “Continuous corners”</li>    <li id="ref-3">Figma, “Desperately seeking squircles”</li>  </ol></div>
<template>  <div class="max-w(480) mx-auto text-sm fg-text-body leading-md">    <p class="m(0)">      Corners are drawn as squircles where the browser has <code class="code">corner-shape</code><button type="button" class="citation" popovertarget="source-1" aria-label="Source 1">        1      </button><span class="popover" id="source-1" popover>        <span class="flex flex-col gap-xs">          <span class="fg-text-strong font-medium">            CSS Borders and Box Decorations Module Level 4          </span><span class="fg-text-muted text-xs">W3C Working Draft · w3.org</span>        </span>      </span> and as circles elsewhere, with the radius scaled so both look equally round.<a class="citation" href="#ref-2" aria-label="Source 2">2</a><a class="citation" href="#ref-3" aria-label="Source 3">3</a>    </p>    <ol class="mt-md pl-md text-xs fg-text-muted">      <li>CSS Borders and Box Decorations Module Level 4</li>      <li id="ref-2">Master UI theme guide, “Continuous corners”</li>      <li id="ref-3">Figma, “Desperately seeking squircles”</li>    </ol>  </div></template>
첫 번째 표시는 팝오버에서 출처를 열고, 나머지는 출처 목록으로 이동합니다.

#출처 연결 방식

인용 표시를 출처에 연결하는 방법은 두 가지이며, 둘 다 스크립트가 필요 없습니다.

  • 출처 목록은 보통 답변이나 글의 끝에 배치합니다. 인용 표시는 <a> 요소이며, href 값으로 목록 항목의 ID를 지정합니다.
  • 팝오버 에는 출처의 제목과 어디에서 가져온 자료인지 표시합니다. 인용 표시는 popovertarget 속성을 지정한 <button>이며, 팝오버 바로 앞에 작성합니다. 팝오버가 열려 있는 동안에는 인용 표시가 잉크 색으로 채워진 상태를 유지합니다. 문단 안에는 <div> 요소를 넣을 수 없으므로 팝오버에 <span> 요소를 사용합니다.

인용 표시 앞에는 공백을 넣지 마세요. 인라인 요소이므로 바로 앞 단어와 함께 줄이 바뀌며, 인용 표시만 새 줄을 시작하는 일은 없습니다.

#접근성

  • 번호만으로는 인용 표시의 접근 가능한 이름으로 충분하지 않습니다. 각 인용 표시의 aria-label에 "출처 2" 같은 이름이나 출처 제목을 지정하세요.
  • 인용 표시를 거치지 않고도 출처를 확인할 수 있게 하세요. 독자가 훑어볼 수 있는 출처 목록이 팝오버 12개보다 쓰기 편합니다.
  • 인용 표시는 작습니다. 번호에는 컨트롤과 같은 글자 굵기와 고정 폭 숫자를 적용하며, 인용 표시가 들어 있는 텍스트의 글자 크기가 커지면 조작 영역도 커집니다.

#클래스

클래스설명
citation표식에는 href가 출처의 id를 가리키는 <a>를 사용하거나, 해당 팝오버 바로 앞에 popovertarget을 지정한 <button>을 배치하세요. "출처 2"와 같은 aria-label을 지정하세요.

#소스

@master/ui/components/citation.css
/* * Citation: a small numbered mark in a sentence that points at where the sentence came from. * It is a link: a chip-toned pill a little smaller than the text and raised a little above its baseline, * with the number in tabular figures. It stays inline, so it wraps with the word it follows. Under the pointer, and while the source it opens is showing, it * fills with ink. The source itself is a popover or a list at the foot of the answer. */@layer components.ui {  .citation {    user-select: none;    -webkit-user-select: none;    /* Inline, not a box of its own: with no space before it, it never starts a line apart from its word. */    display: inline;    margin-inline: .2em .05em;    padding: .25em .5em;    border: 0;    border-radius: 999px;    corner-shape: round;    background: var(--citation-tone, var(--color-surface-chip));    color: var(--citation-ink, var(--color-text-body));    box-shadow: inset 0 0 0 .5px var(--citation-line, var(--color-line-contour));    font: var(--font-weight-control) .6875em/1 var(--font-family-sans);    font-feature-settings: inherit;    font-variant-numeric: tabular-nums;    letter-spacing: 0;    text-decoration: none;    white-space: nowrap;    vertical-align: .22em;    appearance: none;    cursor: pointer;    -webkit-tap-highlight-color: transparent;    /* It answers the pointer at once, as a row in a list does. */    @media (hover: hover) {      &:hover {        background: var(--citation-fill, var(--color-surface-inverse));        color: var(--citation-fill-ink, var(--color-text-inverse));        -webkit-text-fill-color: var(--citation-fill-text, currentColor);        box-shadow: none;      }    }    /* The mark under a press, the one whose source is open, or the one a reader has just followed. */    &:is(:active, [aria-expanded="true"], [aria-current="true"], :has(+ .popover:popover-open)) {      background: var(--citation-fill, var(--color-surface-inverse));      color: var(--citation-fill-ink, var(--color-text-inverse));      -webkit-text-fill-color: var(--citation-fill-text, currentColor);      box-shadow: none;    }    /* The theme's ring, at the offset a link's takes. */    &:focus-visible {      @apply --focus-ring;    }    @media (forced-colors: active) {      outline: 1px solid LinkText;      outline-offset: -1px;      color: LinkText;      /* The fill of an open or followed mark is gone with its colors: it takes the link color as its face. */      &:is([aria-expanded="true"], [aria-current="true"], :has(+ .popover:popover-open)) {        background: LinkText;        color: Canvas;        forced-color-adjust: none;      }      /* The words keep the system's colors, whatever face an ink surface would paint them in. */      &:is(:hover, :active, [aria-expanded="true"], [aria-current="true"], :has(+ .popover:popover-open)) {        -webkit-text-fill-color: currentColor;      }      /* A filled mark is kept out of forced colors, so its ring is given the system's color here. */      &:focus-visible {        outline: 2px solid Highlight;        outline-offset: 2px;      }    }  }}