::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).

/* Usage Example */
::highlight(search-result) {
  /* Styles text found via a search script */
  background-color: yellow;
  color: black;
}
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.

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

Your first month is free

Managed WordPress hosting for faster sites.

Learn more

New CSS drops.

Join 600+ readers who've survived clearfix hacks.

ESC