::target-text
Baseline 2024Newly 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 の擬似要素で、ブラウザーが 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 GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
::target-text |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.