How to Use child-selector in CSS?

first-child-

This will set CSS rule to every first element of selector which is someone’s child. 

last-child-

This will set CSS rule to every last element of selector which is someone’s child. 

first-of-type-

This will set CSS rule to every first selector type of element.

last-of-type-

This will set CSS rule to every last selector type of element.

Tagged : / / / /

How to Use Pseudo-classes in CSS?

A pseudo-class is used to define a special state of an element.

Syntax:-

selector:pseudo-class { property:value; }

Ex: –

div:hover { background-color: red;}

Pseudo-classes

  • :link
  • :visited
  • :hover
  • :active
  • :focus
  • :checked
  • :first-child
  • :first-of-type
  • :nth-child(n)
Tagged : / / / / / / / / / /