Skip to content

CSS Selectors



The :active pseudo-class matches elements that are currently activated by the user.


Buttons and other interactive elements like hyperlinks are active while you press them. Either click on the button or focus it and press the space bar.

  • Press the button to make the selector match
  • Focus the button and press the space bar to make the selector match

Nested elements

The :active pseudo-class also matches parent elements of the activated element. Interactive elements like buttons cannot be nested but the selector works on other elements like a div. However, this is not keyboard accessible.

  • Press the child element to make the selector match both, the parent and the child
Press me (parent)
Press me (child)