Join James Williamson for an in-depth discussion in this video Targeting child elements, part of CSS: Selectors.
- In this chapter, we'll take a look…at structural selectors, that is selectors,…pseudo-class selectors, and pseudo-class elements…that'll match content based on the structure of a document.…We're gonna start by examining what I call…the literal child selectors, and there are three of those.…There is first-child, last-child, and only-child.…Now the reason I call them literal child selectors…is because they only match…if they are literally the first, last, or only elements…within a parent, so, the example that I have…here in the first paragraph that you see…where I'm matching a p:first-child…is only gonna return a match if that paragraph…is the first-child within the parent,…meaning it comes before any other content.…
So it's not looking for the first paragraph,…it's looking to see if that paragraph is the first-child.…Now, for syntax, they're all very similar.…You can see I'm gonna scroll down here a little bit…into the syntax section.…Here's first-child, last-child, and only-child.…Now, you can see they're pretty…
- 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.