TTh, CLA 4-27
1:00 PM -2:50 PM
CRN 71857
Styles can be defined in:
These styles are not dependent on a particular tag but can be applied to multiple types of tags
first-line example where first line of paragraph text has a line through it but the second line does not affected
1. Default browser stylesheet
2. User stylesheet
3. Developer stylesheet
4. Embedded stylesheet
5. Inline styles
1. Find all the style declarations that apply to each element
2. Sort styles by order & weight
3. Sort styles by specificity
Browsers calculate specificity like this:
div {...} = 1 point because it is just an HTML element selector
p.content {...} = 11 because HTML element selector + class selector
p.content ul li {...} = 13 because class selector+ 3 HTML element selectors
body div#primary h1.xHead {...} = 113 because ID + class selector + 3 HTML element selectors
If 2 rules have exactly the same weight, the one furthest down the Cascade wins. (e.g., inline beats external CSS
See Designing more parsimonious CSS using inheritance.