::target-text

Baseline 2024
Newly available

Since December 2024, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

Experimental: 이 기능은 실험적인 기능입니다.
프로덕션 환경에서 사용하기 전에 브라우저 호환성 표를 주의 깊게 확인하세요.

::target-text CSS 의사 요소는 브라우저가 텍스트 조각을 지원하는 경우에 스크롤된 텍스트를 나타냅니다. 이는 작성자가 해당 텍스트의 일부를 강조하는 방법을 선택할 수 있게 합니다.

css
::target-text {
  background-color: pink;
}

구문

css
::target-text {
  /* ... */
}

예제

텍스트 조각 강조하기

css
::target-text {
  background-color: rebeccapurple;
  color: white;
}

CSS의 동작 방식을 확인하려면 scroll-to-text demo 링크를 방문해 보세요.

명세서

Specification
CSS Pseudo-Elements Module Level 4
# selectordef-target-text

브라우저 호환성

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
::target-text

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

같이 보기