Harvard Extension School
CSCI E-12 Fundamentals of Web Site Development | Fall 2019

## The Cascade and Specificity

See: CSS 2.1: Assigning property values, Cascading, and Inheritance

Image from Flickr user Cayusa, used under Creative Commons license.

### Stylesheet Origin

- author stylesheet
- reader (user) stylesheet
- browser (user agent) stylesheet

### Specificity of Selector

- style attribute
- count "id" attributes
- count number of other attributes ("class")
- count element names

### Order

- last occurence has higher specificity

  `@import`-ed stylesheets come before rules in the importing sheet.

Copyright © David Heitmeyer