Skip to content

Latest commit

 

History

History
18 lines (16 loc) · 1.04 KB

selectors.md

File metadata and controls

18 lines (16 loc) · 1.04 KB

Cheatsheet: Selectors

ℹ️ Knowing these will be enough for 99% of use cases

  1. #container → everything with (attribute) id container
  2. .blue → everything with (attribute) class blue
  3. .blue.big → everything with (attribute) class blue and big
  4. button.primarybuttons with (attribute) class primary
  5. .sidebar button → inside .sidebar, buttons
  6. input[type=text]inputs with attribute type of value text
  7. input[type=text]:first → above, but just first
  8. input[type=text]:eq(0) → same as above
  9. input[required]inputs with attribute required (of any value)
  10. a[href^="https"]as with attribute href starting with https
  11. a[href*="kiwi.com"]as with attribute href containing kiwi.com
  12. img[src$=".gif"]imgs with attribute src ending with .gif
  13. input:not(.touched)inputs except those with (attribute) class touched
  14. input:not([required])inputs except those with attribute required (of any value)