← Back to release summary

CSS4 :focus-within pseudo-class

Category
CSS
Type
New or changed feature
Status
Enabled by default (Chrome 60)
Intent stage
None

Summary

The :focus-within pseudo-class applies to elements for which the :focus pseudo class applies. An element also matches :focus-within if one of its descendants in the flat tree (including non-element nodes, such as text nodes) matches the conditions for matching :focus.

Standards & signals

Docs: https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-within

Samples: http://codepen.io/anon/pen/xOLJym https://blogs.igalia.com/mrego/files/2017/05/focus-within-demo.html https://blogs.igalia.com/mrego/files/2017/05/focus-within-menu.html

View on chromestatus.com