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

Seonglae Cho

![CSS [attribute~=value] Selector](https://www.notion.so/image/https%3A%2F%2Fwww.w3schools.com%2Fimages%2Fw3lynx_200.png?table=block&id=4d8cbcc8-a4d0-47b1-aa9a-052fb6023bb7&cache=v2)