Skip to content

Pseudo Classes & Elements

Pseudo-classes are special CSS keywords that allow you to select an element based on its specific state or position.

The element's state or position could include:

  • When it's active.
  • When it's being hovered over by a mouse.
  • When it's the first child of a parent.
  • When it's the last child of a parent.
  • When a link has been visited.
  • When it's disabled.
selector:pseudo-class {
  CSS properties
}

User Action Pseudo-classes

They enable you to change the appearance of elements based on user interactions, improving the overall user experience.

:hover
:active
:focus
:visited
:focus-within
:enabled
:disabled
:target

评论