Descendant selectors select elements contained in other elements. In this video, learn how the CSS descendant selector selects elements that are far separated, not just directly one inside the other.
- [Instructor] Consider this piece of HTML. … It's very, very similar to what you just saw … in the HTML family tree discussion. … Now, what I'd like to do, … is I'd like to style the link in the paragraph … without styling the link that's in the list. … Sure, the easiest thing to do here … would be to drop in a class, … and then style the class, … but before long, classes would take over our document. … Also, on occasion, you don't have access … to the HTML to change it. … That can be true with parts of content management systems … like WordPress or Drupal. … If that's the case, … how can I style the link in the paragraph … without affecting the link in the list? … So, typically the way we'd style a link is simply say, a, … and then we'd say something like color: red, … but that of course is going to style both of our links, … and turn them both red. … So, how do I get just the one in the paragraph? … Well, a descendant selector … is a very simple way of doing this. … Remember that a descendant is simply indicates …
- Targeting classes and IDs
- Working with group selectors
- Targeting element attributes
- Targeting links with pseudo-class selectors
- Targeting child elements and empty elements
- Targeting parent, child, and sibling elements
- Best practices for CSS
- The impact of CSS selectors on performance
Skill Level Intermediate
The power of selectors1m 8s
1. Review of Basic CSS
2. Combinator Selectors
3. Attribute Selectors
Simple attribute selectors2m 47s
4. Pseudo-Classes, Pseudo-Elements, and the Universal Selector
5. Choosing 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.