CSS Selector

Creator
Creator
Seonglae ChoSeonglae Cho
Created
Created
2021 Feb 25 13:46
Editor
Edited
Edited
2023 Oct 23 5:43
Refs
Refs

id is fastest & pseudo class is slowest

Selector Performance Rank
  1. id (#myid)
  1. class (.myclass)
  1. tag (div, h1, p)
  1. adjacent sibling (h1 + p)
  1. child (ul > li)
  1. descendent (li a)
  1. universal (*)
  1. attribute (a[rel=”external”])
  1. pseudo-class and pseudo element (a:hover, li:first)
CSS Selectors
 
 
 
 

Learning Game

selectors

text

 
 

Recommendations