pseudo-element

::target text — CSS reference

Styles text targeted by a text fragment navigation, rather than an element targeted by an ordinary fragment ID. Only the supported subset of highlight properties applies. Do not make important information depend solely on color.

Formal Syntax & Structure

css syntaxcss
::target-text { color: red; }

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>::target-text</title><style>body{margin:8px;background:white;color:black;font:16px/20px sans-serif}*{box-sizing:content-box}#a{color:green}::target-text{color:red}</style><body><p id="a" contenteditable="true" spellcheck="true">Example editable text.</p></body></html>
CSS Reference