Selectors | HTML | CSS

CSS selectors are used to “find” (or select) the HTML elements you want to style.

We can divide CSS selectors into five categories:

  • Simple selectors (select elements based on name, id, class)
  • Combinator selectors (select elements based on a specific relationship between them)
  • Pseudo-class selectors (select elements based on a certain state)
  • Pseudo-elements selectors(select and style a part of an element)
  • Attribute selectors (select elements based on an attribute or attribute value)

Ganesh Patil | TA - Edyoda

1 Like

difference between pseudo class selectors and pseudo elements selectors


Pseudo-class and pseudo-element are both CSS selectors, however pseudo-class represents a virtual CSS class, whereas pseudo-element represents a virtual HTML element .

Pseudo-class selector helps in selecting different “states” of the same element. However pseudo-classes represent states based on information that lies outside the HTML source tree.