The CSS only pseudo-classes select elements that are the only child or the only element of a specific type. In this video, learn how to distinguish between the two and how to use them correctly.
- [Instructor] The next topic is the only selectors, … including only child and only of type. … Let's talk about the easy one first. … That is the only child selector. … Just like in real life, … an only child is one without siblings … of that particular type. … So let's go ahead and take a look at an example of this. … We have here in line number eight, … we have a strong tag here that's all by itself. … It is an only child. … Also, if you take a look here in line six, … this strong tag at the end of the sentence … is an only child also. … It is a child of the M tag … which is surrounding that. … So if we go ahead and write a strong colon only child, … we wind up getting both of those things selected. … That's the definition of an only child. … There it is. … Only of type is a little bit different. … So that indicates that there may be several siblings, … but there's only one of this particular type. … So an example of that is here in the aside, … the aside actually has two children, …
- 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 Beginner
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.