User Action

These pseudo-classes match when users perform specific actions:

  • :hover lets you target elements when a mouse or pen is pointed at them.
  • :active matches elements currently being activated by the user.
  • :focus matches focused elements.
  • :focus-visible matches visible and focused elements.
  • :focus-within matches elements which may apply :focus and have an element which currently matches :focus.