Posted By

loungerdork on 07/07/09


Tagged

selectors


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

myrebel420


CSS Selectors Cheat Sheet


 / Published in: CSS
 

  1. * Matches any element.
  2. E Matches any E element (i.e., an element of type E).
  3. E F Matches any F element that is a descendant of an E element.
  4. E > F Matches any F element that is a child of an element E.
  5. E:first-child Matches element E when E is the first child of its parent.
  6. E:link
  7. E:visited Matches element E if E is the source anchor of a hyperlink of which the target is not yet visited (:link) or already visited (:visited).
  8. E:active
  9. E:hover
  10. E:focus Matches E during certain user actions.
  11. E:lang(c) Matches element of type E if it is in (human) language c (the document language specifies how language is determined).
  12. E + F Matches any F element immediately preceded by a sibling element E.
  13. E[foo] Matches any E element with the "foo" attribute set (whatever the value).
  14. E[foo="warning"] Matches any E element whose "foo" attribute value is exactly equal to "warning".
  15. E[foo~="warning"] Matches any E element whose "foo" attribute value is a list of space-separated values, one of which is exactly equal to "warning".
  16. E[lang|="en"] Matches any E element whose "lang" attribute has a hyphen-separated list of values beginning (from the left) with "en".
  17. DIV.warning Language specific. (In HTML, the same as DIV[class~="warning"].)
  18. E#myid Matches any E element with ID equal to "myid".

Report this snippet  

You need to login to post a comment.