排版
项目列表
正文中的列表,项目符号占用独立的一列。
本页内容
项目列表用于正文,可列出文章要点、方案包含的内容或以句子写成的步骤。标记单独占一列,与对应条目的首行对齐,因此无论文字如何换行,各条目的正文都从同一位置开始。列表使用原生 <ul> 或 <ol>。
项目列表
<ul class="bullets max-w(420) mx-auto"> <li class="bullets-item">Every overlay is a native element, opened without script.</li> <li class="bullets-item"> Tokens retune every component, and a theme is a file of them that selects no component. </li> <li class="bullets-item">Each stylesheet has a contract beside it that says what it promises.</li></ul><ul className="bullets max-w(420) mx-auto"> <li className="bullets-item">Every overlay is a native element, opened without script.</li> <li className="bullets-item"> Tokens retune every component, and a theme is a file of them that selects no component. </li> <li className="bullets-item"> Each stylesheet has a contract beside it that says what it promises. </li></ul><ul class="bullets max-w(420) mx-auto"> <li class="bullets-item">Every overlay is a native element, opened without script.</li> <li class="bullets-item"> Tokens retune every component, and a theme is a file of them that selects no component. </li> <li class="bullets-item">Each stylesheet has a contract beside it that says what it promises.</li></ul><template> <ul class="bullets max-w(420) mx-auto"> <li class="bullets-item">Every overlay is a native element, opened without script.</li> <li class="bullets-item"> Tokens retune every component, and a theme is a file of them that selects no component. </li> <li class="bullets-item"> Each stylesheet has a contract beside it that says what it promises. </li> </ul></template>#标记
默认标记是小圆点。在列表上应用以下两个类之一可更改标记:
bullets-check用当前文字颜色绘制对勾,标示方案包含的功能、新版本带来的改动等。bullets-numbered用等宽数字显示各条目的编号,并将编号对齐到标记列末端,让 9 和 10 的个位对齐。请将此类用于<ol>,因为条目顺序本身具有意义。
对勾和编号
<ul class="bullets bullets-check w(220)"> <li class="bullets-item">Unlimited projects</li> <li class="bullets-item">Custom domains, with certificates issued and renewed for you</li> <li class="bullets-item">Preview for every branch</li></ul><ol class="bullets bullets-numbered w(220)"> <li class="bullets-item">Install the package.</li> <li class="bullets-item">Import the stylesheet after the preset.</li> <li class="bullets-item">Write the markup.</li></ol><> <ul className="bullets bullets-check w(220)"> <li className="bullets-item">Unlimited projects</li> <li className="bullets-item">Custom domains, with certificates issued and renewed for you</li> <li className="bullets-item">Preview for every branch</li> </ul> <ol className="bullets bullets-numbered w(220)"> <li className="bullets-item">Install the package.</li> <li className="bullets-item">Import the stylesheet after the preset.</li> <li className="bullets-item">Write the markup.</li> </ol></><ul class="bullets bullets-check w(220)"> <li class="bullets-item">Unlimited projects</li> <li class="bullets-item">Custom domains, with certificates issued and renewed for you</li> <li class="bullets-item">Preview for every branch</li></ul><ol class="bullets bullets-numbered w(220)"> <li class="bullets-item">Install the package.</li> <li class="bullets-item">Import the stylesheet after the preset.</li> <li class="bullets-item">Write the markup.</li></ol><template> <ul class="bullets bullets-check w(220)"> <li class="bullets-item">Unlimited projects</li> <li class="bullets-item">Custom domains, with certificates issued and renewed for you</li> <li class="bullets-item">Preview for every branch</li> </ul> <ol class="bullets bullets-numbered w(220)"> <li class="bullets-item">Install the package.</li> <li class="bullets-item">Import the stylesheet after the preset.</li> <li class="bullets-item">Write the markup.</li> </ol></template>#未包含的项目
列出方案包含的内容时,也要交代哪些项目未包含。在条目上应用 bullets-off,会用短横线替代标记,并弱化文字颜色。短横线和颜色只提供视觉提示。参照示例,在条目开头的 span 中写上“未包含:”等提示,并用 sr-only 工具类将其从视觉上隐藏,让看不到这两种提示的读者也能获得同样的信息。
未包含
<div class="card w-full max-w(300)"> <div class="card-header"> <h3 class="card-title">Starter</h3> <p class="card-description">For one person and a few projects.</p> </div> <ul class="bullets bullets-check"> <li class="bullets-item">Three projects</li> <li class="bullets-item">Custom domains</li> <li class="bullets-item bullets-off"> <span class="sr-only">Not included:</span>Single sign-on </li> <li class="bullets-item bullets-off"><span class="sr-only">Not included:</span>Audit log</li> </ul></div><div className="card w-full max-w(300)"> <div className="card-header"> <h3 className="card-title">Starter</h3> <p className="card-description">For one person and a few projects.</p> </div> <ul className="bullets bullets-check"> <li className="bullets-item">Three projects</li> <li className="bullets-item">Custom domains</li> <li className="bullets-item bullets-off"> <span className="sr-only">Not included:</span>Single sign-on </li> <li className="bullets-item bullets-off"> <span className="sr-only">Not included:</span>Audit log </li> </ul></div><div class="card w-full max-w(300)"> <div class="card-header"> <h3 class="card-title">Starter</h3> <p class="card-description">For one person and a few projects.</p> </div> <ul class="bullets bullets-check"> <li class="bullets-item">Three projects</li> <li class="bullets-item">Custom domains</li> <li class="bullets-item bullets-off"> <span class="sr-only">Not included:</span>Single sign-on </li> <li class="bullets-item bullets-off"><span class="sr-only">Not included:</span>Audit log</li> </ul></div><template> <div class="card w-full max-w(300)"> <div class="card-header"> <h3 class="card-title">Starter</h3> <p class="card-description">For one person and a few projects.</p> </div> <ul class="bullets bullets-check"> <li class="bullets-item">Three projects</li> <li class="bullets-item">Custom domains</li> <li class="bullets-item bullets-off"> <span class="sr-only">Not included:</span>Single sign-on </li> <li class="bullets-item bullets-off"><span class="sr-only">Not included:</span>Audit log</li> </ul> </div></template>#嵌套与间距
条目中的 bullets 列表缩进至与该条目的正文左缘对齐,并与上方正文相隔 8px。条目间距为 8px,由 --bullets-gap 设置,--bullets-marker 则设置标记列的宽度。列表沿用周围正文的字号、行高和文字颜色,标记与条目的首行对齐。同一种列表既适用于字号为 14px 的卡片,也适用于字号为 17px 的文章。在以前景色为底色的表面上,标记也会随文字一起切换颜色。
#项目列表、列表还是核对清单
项目列表的条目用句子来写。每行都有媒体内容、标题和末尾内容时,使用列表。供读者逐项勾选的待办事项使用核对清单。术语及其对应值使用数据列表。
#无障碍
- 使用
<ul>,顺序有意义时使用<ol>,每个条目使用<li>。屏幕阅读器会读出列表及其条目数量。样式表绘制的标记仅供视觉辨识。 - 在 Safari 中使用 VoiceOver 时,移除了标记的列表需要带有
role="list"才会被读出。如果条目数量关系到读者能否正确理解内容,请添加此属性。 - 对勾和短横线仅在视觉上分别表示“包含”和“未包含”。请用文字说明哪些条目未包含。
#类名
| 类名 | 说明 |
|---|---|
bullets | 列表项间距为 8px。每项的小圆点位于宽 16px 的标记列中,标记列与正文相隔 10px。列表沿用所在位置的文字颜色,在卡片和墨色表面上都清晰可读。 |
bullets-check | 用与文本同色的勾号替代圆点,标记已包含的项目与 bullets 一同使用 |
bullets-numbered | 用于 ol,将各项编号设为等宽数字,并对齐到标记列末端与 bullets 一同使用 |
bullets-item | 一个列表项,标记位于首行,正文起始边缘与其他项对齐 |
bullets-off | 用于未包含的项目,以短横线替代标记,并降低文字的强调程度。与 bullets-item 一同使用 |
#自定义属性
| 属性 | 默认值 | 说明 |
|---|---|---|
--bullets-marker | 1rem | 标记列的宽度 |
--bullets-gap | .5rem | 项目间距 |