文字排版
條列清單
用於正文的清單,項目標記獨立成欄。
本頁內容
條列清單用在正文裡,例如文章中的重點、方案包含的項目,或以句子敘述的步驟。每個標記都排在獨立的欄位中,對齊該項目的第一行,因此文字換行時,所有項目的文字仍沿同一側對齊。清單使用原生的 <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 的文章中,使用 ink 背景時,標記的顏色也會隨文字色調整。
#條列清單、清單與檢查清單
條列清單適合用句子列出重點。每列都有媒體、標題和尾端內容的項目,適合用清單。需要讀者逐項勾選的待辦事項,適合用檢查清單。成對呈現名稱與對應值時,請用資料清單。
#無障礙
- 使用
<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 | 項目之間的間距 |