Selector

Basic Selector

  1. Universal (*)
  2. Type (div)
  3. Class (the Class)
  4. ID # (ID)
  5. The Attribute ([attr] [attr = value] [attr ~ = value] [attr | = value] [attr ^ = value])

Group Selector (any, any)

Combinators

  1. Descendant (A B)
  2. Child (A > B)
  3. General Sibling (A ~ B)
  4. Adjacent Sibling (A + B)
  5. Column ( A || B )

Pseudo

  1. Class (visited)
  2. Element (: : NTH – child)

CSS priority

  1. Thousands – inline style
  2. Hundreds – ID selector
  3. Tens place – class, attribute, pseudo class selector
  4. Bits — element, pseudo element selector
  5. Relationship selectors do not affect priority

Property selector

  1. [attr] Exactly matches the attribute attr
  2. [attr=”value”] Exactly matches the attribute attr with the value value
  3. [attr | = “value”] an exact match attr and begin with the value of the attribute values, the value can be after successive character “-“
  4. [attr~=”value”] Exactly matches the attribute attr and values containing value substrings separated by Spaces
  5. [attr^=”value”] property same as above, value starting with value
  6. [attr$=”value”] same as above, value ending in value
  7. [attr*=”value”] attribute same as above, fuzzy match value containing value
  8. [attr=”ValuE” I] Case insensitive ValuE matching