Join James Williamson for an in-depth discussion in this video Targeting IDs, part of CSS: Selectors.
- ID selectors are similar to class selectors…in that they also target the value…of an element's attribute.…However, since ID attributes must be unique,…ID selectors are much more specific…than either element or class selectors.…So before we get into practicing our own,…I just wanted to very briefly go over the syntax…of ID selectors and what makes…them different from class selectors…because they're very, very similar.…So I'm gonna scroll down into the syntax area here,…and one of the things that you'll notice…about the difference between classes and IDs,…is the character that precedes the attribute value.…
In class selectors it's a period.…In ID selectors, it's the octothorpe character,…or number sign, or pound sign if you will.…But that precedes it, and again…there's no whitespace between…the octothorpe character…and then the actual attribute values.…So #special, we target any element…with the ID of special.…Now notice that we can also make them…element specific so h1#special…would apply to only the ID attribute special…
- Targeting classes and IDs
- Working with group selectors
- Targeting element attributes
- String matching
- Targeting links with pseudo-class selectors
- Targeting child elements and empty elements
- Targeting parent, child, and sibling elements
- Matching patterns
- Writing efficient selectors
Skill Level Intermediate
CSS: Advanced Typographic Techniqueswith James Williamson3h 14m Intermediate
HTML5: Graphics and Animation with Canvaswith Joe Marini3h 7m Intermediate
1. Basic Selectors
2. Attribute Selectors
3. User Action Pseudo-Class Selectors
4. Structural Selectors
6. Matching Patterns
7. Writing Efficient Selectors
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.