::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-textCSS擬似要素で、ブラウザーが scroll-to-text フラグメントに対応している場合にスクロール先のテキストを表します。これによって、節のテキストを強調表示させることができます。

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

構文

Error: could not find syntax for this item

scroll-to-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

関連情報