網站導覽

v2.1.0
文字排版

引文

將他人的話與自己的文字區隔開來。

本頁內容

引文將他人的話與你的文字區隔開來。置於正文時,引文以低調的直線標出起始側,文字則沿用標題的文字色。直線採獨立繪製,無須使用邊框,兩端因此能保持圓弧。

引文

<figure class="quote max-w(420) mx-auto">  <blockquote class="quote-body">    <p class="quote-text">Good tools make the next step clear and leave room for the work.</p>  </blockquote>  <figcaption class="quote-source">    <span class="avatar avatar-sm"><img class="avatar-image" src="/demo/portrait-1.svg" alt></span>    <span><span class="quote-name">Alex Morgan</span>Design lead, Atlas</span>  </figcaption></figure>
<figure className="quote max-w(420) mx-auto">  <blockquote className="quote-body">    <p className="quote-text">Good tools make the next step clear and leave room for the work.</p>  </blockquote>  <figcaption className="quote-source">    <span className="avatar avatar-sm">      <img className="avatar-image" src="/demo/portrait-1.svg" alt="" />    </span>    <span><span className="quote-name">Alex Morgan</span>Design lead, Atlas</span>  </figcaption></figure>
<figure class="quote max-w(420) mx-auto">  <blockquote class="quote-body">    <p class="quote-text">Good tools make the next step clear and leave room for the work.</p>  </blockquote>  <figcaption class="quote-source">    <span class="avatar avatar-sm"><img class="avatar-image" src="/demo/portrait-1.svg" alt></span>    <span><span class="quote-name">Alex Morgan</span>Design lead, Atlas</span>  </figcaption></figure>
<template>  <figure class="quote max-w(420) mx-auto">    <blockquote class="quote-body">      <p class="quote-text">Good tools make the next step clear and leave room for the work.</p>    </blockquote>    <figcaption class="quote-source">      <span class="avatar avatar-sm">        <img class="avatar-image" src="/demo/portrait-1.svg" alt>      </span>      <span><span class="quote-name">Alex Morgan</span>Design lead, Atlas</span>    </figcaption>  </figure></template>

將引文的每一段放在 quote-text 中。出處不屬於引文本身,因此有出處的引文是一個 <figure>:引文放在帶有 quote-body 的 <blockquote> 中,出處則接在其後,放在帶有 quote-source 的 <figcaption> 裡,其中放入以主要文字色顯示的 quote-name,再加一行較低調的文字來標示身分或地點。有頭像時,將它放在姓名前。作品名稱請放在 <cite> 中。沒有出處的引文直接使用 <blockquote> 即可。

#醒目引文

quote-lg 讓引文本身成為視覺焦點。起始側改用開引號,並讓各行長度更均衡。每頁使用一處,長度以一兩句為限。

醒目引文

<figure class="quote quote-lg max-w(480) mx-auto">  <blockquote class="quote-body">    <p class="quote-text">      We replaced four libraries with a stylesheet, and the interface got quieter.    </p>  </blockquote>  <figcaption class="quote-source">    <span class="avatar"><img class="avatar-image" src="/demo/portrait-3.svg" alt></span>    <span><span class="quote-name">Sam Lee</span>Engineering, <cite>Orbit Review</cite></span>  </figcaption></figure>
<figure className="quote quote-lg max-w(480) mx-auto">  <blockquote className="quote-body">    <p className="quote-text">      We replaced four libraries with a stylesheet, and the interface got quieter.    </p>  </blockquote>  <figcaption className="quote-source">    <span className="avatar">      <img className="avatar-image" src="/demo/portrait-3.svg" alt="" />    </span>    <span><span className="quote-name">Sam Lee</span>Engineering, <cite>Orbit Review</cite></span>  </figcaption></figure>
<figure class="quote quote-lg max-w(480) mx-auto">  <blockquote class="quote-body">    <p class="quote-text">      We replaced four libraries with a stylesheet, and the interface got quieter.    </p>  </blockquote>  <figcaption class="quote-source">    <span class="avatar"><img class="avatar-image" src="/demo/portrait-3.svg" alt></span>    <span><span class="quote-name">Sam Lee</span>Engineering, <cite>Orbit Review</cite></span>  </figcaption></figure>
<template>  <figure class="quote quote-lg max-w(480) mx-auto">    <blockquote class="quote-body">      <p class="quote-text">        We replaced four libraries with a stylesheet, and the interface got quieter.      </p>    </blockquote>    <figcaption class="quote-source">      <span class="avatar"><img class="avatar-image" src="/demo/portrait-3.svg" alt></span>      <span><span class="quote-name">Sam Lee</span>Engineering, <cite>Orbit Review</cite></span>    </figcaption>  </figure></template>

#多段引文

多段引文

<blockquote class="quote max-w(420) mx-auto">  <p class="quote-text">    The first version shipped with eleven components. We thought that was a start.  </p>  <p class="quote-text">It turned out to be most of what an interface needs, most of the time.</p></blockquote>
<blockquote className="quote max-w(420) mx-auto">  <p className="quote-text">    The first version shipped with eleven components. We thought that was a start.  </p>  <p className="quote-text">    It turned out to be most of what an interface needs, most of the time.  </p></blockquote>
<blockquote class="quote max-w(420) mx-auto">  <p class="quote-text">    The first version shipped with eleven components. We thought that was a start.  </p>  <p class="quote-text">It turned out to be most of what an interface needs, most of the time.</p></blockquote>
<template>  <blockquote class="quote max-w(420) mx-auto">    <p class="quote-text">      The first version shipped with eleven components. We thought that was a start.    </p>    <p class="quote-text">It turned out to be most of what an interface needs, most of the time.</p>  </blockquote></template>

#無障礙

  • 獨立成塊的引文使用 <blockquote>,句中的引文使用 <q>。可用 cite 屬性記錄來源網址。
  • 醒目引文的開引號由樣式表繪製,僅供裝飾,螢幕閱讀器不會朗讀。請勿在引文文字中再輸入引號。
  • 頭像旁已顯示引文來源的姓名,因此頭像的 alt 請留空。

#類別

類別說明
quote引文的起始側加上 2px 的側邊線。
quote-lg醒目引文使用較大的文字,各行長度均衡,並以上方的起始引號取代側邊線。搭配 quote 使用
quote-body有出處的引言中的 blockquote:此時引言本身是 figure,出處接在這個部件之後,放在 figcaption 中,位於引用文字之外。
quote-text引文中的一個段落。
quote-source顯示發言者姓名和一行色調較淡的出處文字,旁邊可加上頭像。
quote-name名稱獨立成行,採用醒目的文字色。

#原始碼

@master/ui/components/quote.css
/* * Quote: someone else's words, set apart from yours. * A quotation in running text hangs from a soft rail at its start. A large one is a pull quote: the words * carry it, balanced over their lines, under an opening mark. The source follows, quiet, with a name in ink. * A source is not part of the quotation, so a quote with one is a <figure>: the words in a <blockquote> with * quote-body, the source after it in a <figcaption>. A quote with no source is the <blockquote> itself. */@layer components.ui {  .quote {    position: relative;    display: grid;    gap: .75rem;    min-width: 0;    margin: 0;    padding-block: .125rem;    padding-inline: 1.125rem 0;    color: var(--color-text-strong);    font-size: .9375rem;    line-height: 1.6;    /* The rail: two pixels of line with round ends. It is drawn, not a border, so it never ends in a corner. */    &::before {      content: '';      position: absolute;      inset-block: 0;      inset-inline-start: 0;      width: 2px;      border-radius: 999px;      background: var(--color-line-strong);    }    /* Large: a pull quote. The rail gives way to an opening mark, and the words are balanced. */    &.quote-lg {      gap: 1.25rem;      padding: 0;      font-size: 1.375rem;      line-height: 1.4;      letter-spacing: -.015em;      &::before {        position: static;        width: 1.75rem;        height: 1.25rem;        border-radius: 0;        background: var(--color-line-mark);        mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 20'%3E%3Cpath d='M0 20v-7.2C0 5.9 3.5 1.4 10.4 0l1.3 2.8C8.2 4 6.4 6.3 6.2 9.6H12V20zm16 0v-7.2C16 5.9 19.5 1.4 26.4 0l1.3 2.8C24.2 4 22.4 6.3 22.2 9.6H28V20z'/%3E%3C/svg%3E") center / contain no-repeat;      }      &:dir(rtl)::before {        scale: -1 1;      }      /* Han, kana and Hangul are not drawn tighter: tracking set for Latin capitals would crowd them. */      &:is(:lang(zh), :lang(ja), :lang(ko)) {        letter-spacing: 0;      }      .quote-text {        text-wrap: balance;      }    }    @media (forced-colors: active) {      &::before {        background: CanvasText;      }    }  }  /* The <blockquote> inside a quote that is a <figure>: it holds the paragraphs, spaced as the quote spaces them. */  .quote-body {    display: grid;    gap: inherit;    min-width: 0;    margin: 0;  }  /* A paragraph of the quotation. */  .quote-text {    margin: 0;    text-wrap: pretty;    overflow-wrap: anywhere;    hanging-punctuation: first;  }  /* Who said it, and where: an avatar, a name in ink and a quiet line, in the <figcaption>. Put the title of a work in <cite>. */  .quote-source {    display: flex;    align-items: center;    gap: .625rem;    min-width: 0;    color: var(--color-text-muted);    font-size: .8125rem;    font-style: normal;    line-height: 1.4;    letter-spacing: 0;    /* A source may be a long address: it breaks inside the row rather than pushing out of the quote. */    overflow-wrap: anywhere;  }  .quote-name {    display: block;    color: var(--color-text-strong);    font-weight: var(--font-weight-control);  }}