排版
文本高亮
像荧光笔一样标出相关词句。
本页内容
高亮标记像荧光笔划过文字,用于标出搜索结果中匹配的部分,或审阅者指出的短语。它用一层淡墨色标出文字,在各类表面上都清晰可见,也不会干扰状态颜色的识别。在原生 <mark> 上使用 .mark。
文本高亮
<ul class="flex flex-col gap-xs m(0) p(0) text-sm fg-text-body"> <li class="flex"><span><mark class="mark">Moon</mark>stone palette</span></li> <li class="flex"><span>Half-<mark class="mark">moon</mark> icon</span></li> <li class="flex"><span>Phases of the <mark class="mark">moon</mark>, a field guide</span></li></ul><ul className="flex flex-col gap-xs m(0) p(0) text-sm fg-text-body"> <li className="flex"><span><mark className="mark">Moon</mark>stone palette</span></li> <li className="flex"><span>Half-<mark className="mark">moon</mark> icon</span></li> <li className="flex"> <span>Phases of the <mark className="mark">moon</mark>, a field guide</span> </li></ul><ul class="flex flex-col gap-xs m(0) p(0) text-sm fg-text-body"> <li class="flex"><span><mark class="mark">Moon</mark>stone palette</span></li> <li class="flex"><span>Half-<mark class="mark">moon</mark> icon</span></li> <li class="flex"><span>Phases of the <mark class="mark">moon</mark>, a field guide</span></li></ul><template> <ul class="flex flex-col gap-xs m(0) p(0) text-sm fg-text-body"> <li class="flex"><span><mark class="mark">Moon</mark>stone palette</span></li> <li class="flex"><span>Half-<mark class="mark">moon</mark> icon</span></li> <li class="flex"><span>Phases of the <mark class="mark">moon</mark>, a field guide</span></li> </ul></template>在列表框、组合框或命令面板中,随着用户输入,用高亮标记包裹各选项中匹配的部分。
#当前匹配项
当读者像使用页内查找那样逐项浏览匹配结果时,为当前匹配项设置 aria-current="true"。该项的高亮背景会填充墨色。
当前匹配项
<p class="m(0) max-w(420) text-sm leading-md fg-text-body"> Corners nest by their <mark class="mark">inset</mark>: a container's radius is its content's radius plus the <mark class="mark" aria-current="true">inset</mark> between them, so the gap keeps one width around the bend. A button 4px inside a well takes the well's radius minus that <mark class="mark">inset</mark>.</p><p className="m(0) max-w(420) text-sm leading-md fg-text-body"> Corners nest by their <mark className="mark">inset</mark>: a container's radius is its content's radius plus the <mark className="mark" aria-current="true">inset</mark> between them, so the gap keeps one width around the bend. A button 4px inside a well takes the well's radius minus that <mark className="mark">inset</mark>.</p><p class="m(0) max-w(420) text-sm leading-md fg-text-body"> Corners nest by their <mark class="mark">inset</mark>: a container's radius is its content's radius plus the <mark class="mark" aria-current="true">inset</mark> between them, so the gap keeps one width around the bend. A button 4px inside a well takes the well's radius minus that <mark class="mark">inset</mark>.</p><template> <p class="m(0) max-w(420) text-sm leading-md fg-text-body"> Corners nest by their <mark class="mark">inset</mark>: a container's radius is its content's radius plus the <mark class="mark" aria-current="true">inset</mark> between them, so the gap keeps one width around the bend. A button 4px inside a well takes the well's radius minus that <mark class="mark">inset</mark>. </p></template>#品牌色和下划线
mark-brand 用淡淡的品牌色标出体现页面主题的那个短语。mark-underline 将高亮笔迹移到文字底部,绘制成粗下划线。浏览器将线条绘制在字形后方,文字换行后也会继续绘制。
品牌色和下划线
<p class="m(0) max-w(420) text-md leading-md fg-text-strong"> Native HTML and CSS components with <mark class="mark mark-brand">no runtime</mark>, built on the platform and <mark class="mark mark-underline">finished by hand, one component at a time</mark>.</p><p className="m(0) max-w(420) text-md leading-md fg-text-strong"> Native HTML and CSS components with <mark className="mark mark-brand">no runtime</mark>, built on the platform and <mark className="mark mark-underline">finished by hand, one component at a time</mark>.</p><p class="m(0) max-w(420) text-md leading-md fg-text-strong"> Native HTML and CSS components with <mark class="mark mark-brand">no runtime</mark>, built on the platform and <mark class="mark mark-underline">finished by hand, one component at a time</mark>.</p><template> <p class="m(0) max-w(420) text-md leading-md fg-text-strong"> Native HTML and CSS components with <mark class="mark mark-brand">no runtime</mark>, built on the platform and <mark class="mark mark-underline">finished by hand, one component at a time</mark>. </p></template>#无障碍
<mark>表示文字与当前内容相关。要强调重要性,请使用<strong>。大多数屏幕阅读器不会读出高亮标记,因此结果本身必须能独立传达含义。- 高亮标记保留文字原色,并使用约 10% 不透明度的墨色作为底色,保持对比度。在强制颜色模式下,使用系统的
Mark和MarkText。 - 高亮标记跨行时,每行都保留内边距和圆角。
#类名
| 类名 | 说明 |
|---|---|
mark | 为文字添加淡色底纹,底纹取色于周围文字。 |
mark-brand | 用淡品牌色为点明页面主题的一个短语添加底纹。与 mark 一同使用 |
mark-underline | 用文字底部的粗线替代淡色底纹。与 mark 一同使用 |