CSS is best understood by reading it right to left. In this video, learn how starting at the most specific element in a CSS selector and working your way toward the more broad elements can help target CSS styles.
- [Instructor] Several times in this chapter, … I have mentioned writing selectors … from left to right but reading them from right to left. … What on earth am I talking about? … When reading and understanding a selector, … especially a complex selector … with several components start at the last item … in the selector and expand from there. … For example in this selector we start with a, … then we're going to move to p, … and finally we'll go to the class of warning. … So in other words this selects any a element, … descended from a p element, that is a child … of any element with a class of warning. … However, when we write selectors we're going … to start at the outside, getting more … and more specific as we move inwards. … Being able to read selectors … is the first step in understanding them well. … For example, consider these two selectors … which are commonly confused. … Note that the first selector has no space, … while the second selector does have a space in the middle. … If you practice reading these from right to left you'll see …
- 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.