탐색

v2.1.0
타이포그래피

강조 표시

눈여겨볼 말에 형광펜을 칠한 듯한 강조 표시입니다.

이 페이지의 내용

강조 표시는 검색어와 일치하는 결과의 일부나 검토자가 짚은 구절처럼 눈여겨볼 말에 형광펜을 칠한 듯한 효과를 줍니다. 특정 색조 대신 잉크 색을 옅게 깔아 어느 표면에서든 글자가 잘 읽히고 상태 색상도 묻히지 않습니다. 기본 HTML 요소인 <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입니다

#소스

@master/ui/components/mark.css
/* * Mark: a stroke of highlighter over the words that matter, such as the part of a result that matches * a search. It is a wash of ink, not a hue: it reads on every surface and never competes with status colors. * A holder of results may set --mark-ink and --mark-weight, as an option of a listbox does. * The match a reader has stepped to is filled with ink. The wash, the stroke and the fill are read through * --mark-tone, --mark-line, --mark-fill, --mark-fill-ink and --mark-fill-text, which a surface of ink sets with @apply --on-ink, * so a mark in a tooltip or a sent message is drawn from that surface's own text color. */@layer components.ui {  .mark {    margin-inline: -.125em;    padding: .0625em .125em;    border-radius: calc(.1875rem * var(--corner-scale));    corner-shape: var(--corner-shape);    background: var(--mark-tone, var(--color-mark));    /* A list of results sets --mark-ink and --mark-weight, so a match keeps the title's ink inside a muted line. */    color: var(--mark-ink, inherit);    font-weight: var(--mark-weight, inherit);    box-decoration-break: clone;    -webkit-box-decoration-break: clone;    /* Brand: a wash of the brand color, for the one phrase a page is about. */    &.mark-brand {      background: color-mix(in oklab, var(--color-brand) 18%, transparent);    }    /*     * The current match among several: set aria-current="true" on it as the reader steps through. It follows the     * brand wash, so a current brand match is filled with ink too and its inverse words stay legible.     */    &[aria-current="true"] {      background: var(--mark-fill, var(--color-surface-inverse));      color: var(--mark-fill-ink, var(--color-text-inverse));      -webkit-text-fill-color: var(--mark-fill-text, currentColor);    }    /*     * Underline: the stroke runs along the foot of the words instead of over them. It is a thick underline,     * which the browser paints behind the letters and carries across line breaks.     */    &.mark-underline {      margin-inline: 0;      padding: 0;      border-radius: 0;      background: none;      /* Longhands: the compiler orders declarations, and the shorthand would reset the thickness after it. */      text-decoration-line: underline;      text-decoration-thickness: .4em;      text-decoration-color: var(--mark-line, var(--color-mark-underline));      text-decoration-skip-ink: none;      text-underline-offset: -.18em;      /* The current match is filled with ink as any mark's is, and the stroke steps aside under it. */      &[aria-current="true"] {        /* The fill stands a little past the letters, as a wash's does, without moving them. */        margin-inline: -.125em;        padding: .0625em .125em;        border-radius: calc(.1875rem * var(--corner-scale));        background: var(--mark-fill, var(--color-surface-inverse));        text-decoration-color: transparent;      }    }    @media (forced-colors: active) {      background: Mark;      color: MarkText;      forced-color-adjust: none;      &.mark-brand {        background: Mark;      }      /* The stroke takes the mark's color, and the words over it keep the page's ink. */      &.mark-underline {        background: none;        color: CanvasText;        text-decoration-color: Mark;      }      &[aria-current="true"], &.mark-underline[aria-current="true"] {        background: Highlight;        color: HighlightText;        -webkit-text-fill-color: currentColor;        text-decoration-color: transparent;      }    }  }}