导航

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 属性记录来源的 URL。
  • 醒目引文的左引号是样式表绘制的装饰,屏幕阅读器不会朗读它。请勿在醒目引文的文字中再输入引号。
  • 出处中的头像与旁边的姓名指向同一人,因此将头像的 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);  }}