VOOZH about

URL: https://www.geeksforgeeks.org/css/css-focus-within-selector/

⇱ CSS :focus-within Selector - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

CSS :focus-within Selector

Last Updated : 24 Jul, 2024

The :focus-within pseudo-class is a selects an element that consists of a focused element as a child. The CSS rules are applied when any child element gets focus. Example includes clicking a link, selecting an input, etc.

Syntax:

:focus {
/* CSS Properties */
}

Example: Below is the example which illustrates the use of :focus-within pseudo-class Selector.

Output:


Supported Browsers:

  • Google Chrome 60+
  • Edge 79+
  • Firefox 52+
  • Opera 47+
  • Safari 10.1+
Comment
Article Tags: