Skip to content

Latest commit

 

History

History
15 lines (13 loc) · 934 Bytes

File metadata and controls

15 lines (13 loc) · 934 Bytes

What are pseudo-classes?

A pseudo-class is basically used to define or specify a special state of an HTML element. This can be used in conjunction with an existing CSS selector to add effects to elements based on their state. For instance, changing the style of an element when a user hovers over it or using different styles for visited and unvisited links. The pseudo-class gives you the ability to do all of this.

Syntax:

selector: pseudo-class{
    property: value;
}

In CSS, there are many pseudo-classes, but the ones that are most frequently used are as follows:

  • :visited pseudo-class: Select the links that the user has already visited.
  • :hover pseudo-class: A special effect can be added to an element when the mouse pointer is over it.
  • :active pseudo-class: Select the element that becomes active when the user clicks on it.
  • :focus pseudo-class: Select an element that is currently focused by the user.