CSS Tutorial 5
Prepared by: Anthony Larrain
CSS Selectors
Class Selectors
- Allows you to select which elements will have a particular style.
- Allows you to make up your own name for a style or group of styles.
- Can be used many times in a document.
Example 1
Suppose you wanted most of the body text blue and some portions red.
Then in the HTML document that uses these styles use the class
attribute to call in the style.
This text would appear blue
This text would appear red
This text would appear red
Id Selectors
- Same idea as class selector but can only be used once per html document.
- The ID name is preceded with the hash '#' symbol.
- Use the
id
attribute to call in the style.
This text would appear blue
This text would appear red
Grouped Selectors
Suppose you wanted all headings h1 h2 h3 .. to be green