::highlight

Targets custom text highlights created via the CSS Highlight API. It allows you to style specific ranges of text programmatically (ideal for search-and-highlight features).

Quick example

::highlight(search-result) {
  /* Styles text found via a search script */
  background-color: yellow;
  color: black;
}

::highlight Browser Support

Widely available Since 2015 92% global usage

This feature is well established and works across many devices and browser versions. It has been available across browsers since 2015.

Safe to use without fallbacks.

105+
140+
17.2+
105+
Interop 2026 focus area ? Learn more →
ESC