pseudo-element

::search text — CSS reference

Styles text identified by the user agent as a search match. Browser find UI, not querySelector or a class, establishes the highlight. Only the supported subset of highlight properties applies. Do not make important information depend solely on color.

Formal Syntax & Structure

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

Working Example

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