Web platform features explorer

:host-context()

This feature is discouraged — The CSS Working Group removed :host-context() from the specification, due to opposition from vendors, performance considerations, and interest in alternatives.

Consider using Container style queries instead.

For more information, see: w3c/csswg-drafts/issues/1914#issuecomment-2737310093 (GitHub)

The :host-context() CSS pseudo-class selects the containing element of the shadow tree in which it is used if that element or an ancestor matches the provided selector.

Status

Discouraged

MDN documentation

Browser support

  • Chrome 54 Released on 2016-10-12
  • Chrome Android 54 Released on 2016-10-19
  • Edge 79 Released on 2020-01-15
  • Firefox See bugzil.la/1082060
  • Firefox for Android See bugzil.la/1082060
  • Safari
  • Safari on iOS