Selectors and specificity

Selectors

Basic Selectors

Complex Selectors are

Specificity

  1. not all selectors are created equal
    1. tags -> 1
    2. classes -> 10
    3. ids -> 100
  2. you can calculate the specificity of a selector by adding up all the values
  3. ie: body.my-class#my-id has a specificity of: 111
    1. body -> 1
    2. .my-class -> 10
    3. #my-id -> 100
    4. so 1 + 10 + 100 = 111

Practice

  1. this
  2. this
  3. this..?