탐색

v2.1.0
타이포그래피

수정 표시

바뀐 문장 안에서 추가한 단어를 표시하고 삭제한 단어에 취소선을 긋습니다.

이 페이지의 내용

수정 표시는 편집 제안, 변경 내용 추적, 오류 정정에 사용합니다. 바뀐 문장 안에서 추가한 단어를 표시하고 삭제한 단어에 취소선을 긋습니다. HTML 기본 요소 두 개에 각각 클래스를 하나씩 적용합니다. <ins> 요소에 ins 클래스를 적용하면 추가한 단어에 옅은 성공 상태 색상의 배경과 가는 밑줄이 생깁니다. <del> 요소에 del 클래스를 적용하면 삭제한 단어의 글자가 조금 옅어지되 텍스트에 필요한 대비는 유지되고, 옅은 위험 상태 색상의 배경과 취소선이 생깁니다.

수정 표시

<p class="m(0) max-w(480) mx-auto leading-md">  The release is planned for <del class="del">Thursday</del> <ins class="ins">Tuesday the 17th</ins>, and it <del class="del">will probably include</del> <ins class="ins">includes</ins> the new contracts. Every stylesheet has a contract beside it<ins class="ins">, and the two change together in the same commit</ins>.</p>
<p className="m(0) max-w(480) mx-auto leading-md">  The release is planned for <del className="del">Thursday</del> <ins className="ins">Tuesday the 17th</ins>, and it <del className="del">will probably include</del> <ins className="ins">includes</ins> the new contracts. Every stylesheet has a contract beside it<ins className="ins">, and the two change together in the same commit</ins>.</p>
<p class="m(0) max-w(480) mx-auto leading-md">  The release is planned for <del class="del">Thursday</del> <ins class="ins">Tuesday the 17th</ins>, and it <del class="del">will probably include</del> <ins class="ins">includes</ins> the new contracts. Every stylesheet has a contract beside it<ins class="ins">, and the two change together in the same commit</ins>.</p>
<template>  <p class="m(0) max-w(480) mx-auto leading-md">    The release is planned for <del class="del">Thursday</del> <ins class="ins">Tuesday the 17th</ins>, and it <del class="del">will probably include</del> <ins class="ins">includes</ins> the new contracts. Every stylesheet has a contract beside it<ins class="ins">, and the two change together in the same commit</ins>.  </p></template>

#두 가지 요소

추가와 삭제의 의미는 요소 자체가 전달하며, 클래스는 시각적 표현을 담당합니다. <ins> 및 <del> 요소는 단어에 어떤 변경이 있었는지 스크린 리더, 검색 엔진, 스타일시트가 없는 브라우저에 전달합니다. 브라우저는 기본적으로 각각 밑줄과 취소선으로 표시합니다. 두 요소 모두 변경 시점을 기록하는 datetime과 변경 내용을 설명하는 문서를 가리키는 cite 속성을 지원합니다.

옅은 배경색은 클래스가 적용합니다. 강조 표시와 마찬가지로 수정 표시는 줄바꿈이 있어도 이어집니다. 추가한 텍스트가 여러 줄에 걸치면 각 줄의 양 끝이 둥글게 표시됩니다.

#상태 색상과 선 표시

추가와 삭제는 단어의 상태이므로 수정 표시에는 두 가지 상태 색상을 사용합니다. 색상에는 항상 선을 함께 표시합니다. 추가한 단어에는 밑줄을 긋고, 삭제한 단어에는 취소선을 긋습니다. 따라서 색을 볼 수 없는 독자도 둘을 구분할 수 있습니다. 강제 색상 모드에서도 옅은 배경색만 사라지고 선은 남아 둘을 구분할 수 있습니다.

카드와 텍스트의 수정 표시

<div class="card w-full max-w(360)">  <p class="m(0)">    Ships on <del class="del">Thursday</del> <ins class="ins">Tuesday</ins>, with the contracts.  </p></div><div class="sheet sheet-inverse p(20) w-full max-w(360)">  <p class="m(0)">    Ships on <del class="del">Thursday</del> <ins class="ins">Tuesday</ins>, with the contracts.  </p></div>
<>  <div className="card w-full max-w(360)">    <p className="m(0)">      Ships on <del className="del">Thursday</del> <ins className="ins">Tuesday</ins>, with the contracts.    </p>  </div>  <div className="sheet sheet-inverse p(20) w-full max-w(360)">    <p className="m(0)">      Ships on <del className="del">Thursday</del> <ins className="ins">Tuesday</ins>, with the contracts.    </p>  </div></>
<div class="card w-full max-w(360)">  <p class="m(0)">    Ships on <del class="del">Thursday</del> <ins class="ins">Tuesday</ins>, with the contracts.  </p></div><div class="sheet sheet-inverse p(20) w-full max-w(360)">  <p class="m(0)">    Ships on <del class="del">Thursday</del> <ins class="ins">Tuesday</ins>, with the contracts.  </p></div>
<template>  <div class="card w-full max-w(360)">    <p class="m(0)">      Ships on <del class="del">Thursday</del> <ins class="ins">Tuesday</ins>, with the contracts.    </p>  </div>  <div class="sheet sheet-inverse p(20) w-full max-w(360)">    <p class="m(0)">      Ships on <del class="del">Thursday</del> <ins class="ins">Tuesday</ins>, with the contracts.    </p>  </div></template>

#문장과 코드의 변경 표시

수정 표시는 문장 안에서 바뀐 단어에 사용합니다. 코드에서 줄 전체가 바뀌었다면 코드 블록에 code-line-added 및 code-line-removed 클래스를 사용해 해당 줄과 줄 옆 여백을 표시합니다. 내용이 그대로인 단어를 강조할 때는 강조 표시를 사용합니다.

#접근성

  • <ins> 및 <del> 요소를 사용하며, <span>에는 클래스를 적용하지 않습니다. 요소 자체가 의미를 전달하므로 검사기는 다른 요소에 이 클래스를 적용하면 오류로 처리합니다.
  • 추가와 삭제를 기본적으로 읽어 주는지는 스크린 리더마다 다릅니다. 변경 내용이 글을 이해하는 데 중요하다면 문장에도 그 내용을 명시하거나 본문 앞에 변경 사항을 요약합니다.
  • 단어를 교체할 때는 삭제한 단어를 먼저 쓰고 한 칸 띄운 뒤 추가한 단어를 쓰면 가장 읽기 쉽습니다.

#클래스

클래스설명
insins 요소로 삽입된 텍스트를 표시합니다. 얇은 밑줄을 긋고 옅은 성공 색상을 배경에 적용합니다
deldel 요소로 삭제된 텍스트를 표시합니다. 텍스트 대비 4.5:1을 유지하는 한도에서 전경색을 옅게 하고, 옅은 위험 색상 배경을 적용한 뒤 텍스트에 취소선을 긋습니다.

#소스

@master/ui/components/revision.css
/* * Revision: words added and words struck, inside the sentence they change. * On the native <ins> and <del>, which say what happened to anyone who cannot see it. Inserted words lie on * a wash of the success hue over a fine underline; deleted words take a quieter ink, on a wash of the * danger hue under a strike. The hue is a status here and never stands alone: the underline and the strike * say the same thing without it. Both carry across line breaks, like a stroke of highlighter. * For whole lines of code that changed, use a code block's added and removed lines. */@layer components.ui {  .ins, .del {    margin-inline: -.125em;    padding: .0625em .125em;    border-radius: calc(.1875rem * var(--corner-scale));    corner-shape: var(--corner-shape);    /* Longhands: the compiler orders declarations, and the shorthand would reset the thickness after it. */    text-decoration-thickness: 1px;    text-decoration-skip-ink: none;    box-decoration-break: clone;    -webkit-box-decoration-break: clone;  }  .ins {    background: color-mix(in oklab, var(--color-success) 13%, transparent);    color: inherit;    text-decoration-line: underline;    text-decoration-color: color-mix(in oklab, var(--color-success) 60%, transparent);    text-underline-offset: .22em;  }  /*   * A fifth of the ink is let go, no more: the struck words are still read, and at 80% body text keeps 4.5:1 on a   * page and on a raised sheet in both themes. Half the ink fell under 3:1.   */  .del {    background: color-mix(in oklab, var(--color-danger) 10%, transparent);    color: color-mix(in oklab, currentColor 80%, transparent);    text-decoration-line: line-through;    text-decoration-color: color-mix(in oklab, var(--color-danger) 75%, transparent);  }  /* After the washes and the lines above, so it is not overruled by them. */  @media (forced-colors: active) {    .ins, .del {      background: none;      text-decoration-color: CanvasText;    }  }}