!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Lecture 5: CSS (part 2)
Lecture 5
CSS (part 2)
Ketan Mayer-Patel
University of North Carolina
Pseudo classes
E:link
visited
E:visited
active
E:active
hover
E:hover
focus
E:focus
Example 1
Pseudo elements
E:first-line
first-letter
E:first-letter
Example 2
Combining selectors
- List selectors with comma
- Applies attribute/values to all selectors in the list
- Chain selectors together
- Generally can replace any element name with a selector
- Creates compound selector
- Reads left to right
- Example 3
The Cascade
- Which selector prevails if more than one applies?
- First by where specified.
- Inline -> External -> Browser Default
- Then by
weight
- Number of elements in the rule +
- Number of classes specified * 10 +
- Number of IDs specified * 100
- Most style info inherited from parent if not specified.
- Example 4
Attribute Values
- Colors
- Named
- By value
- Hex notation, rgb function notation
- URL
- Lengths and Sizes
- Units: px, pt, pc, em, cm, in, mm
- Percentages
- Keywords
- small, smaller, large, larger, etc.
Box Model
