Explore the different types of CSS selectors and learn how to choose the best selectors for targeting different HTML elements.
- [Jen] 15 years ago when we could first use CSS in our documents reliably, and with reasonable browser support, our selector choices were limited to classes, IDs, elements, and the descendant selector. Today, we have dozens of choices of selectors. However, in real-world web development, many try to stick to classes only as the way of managing their CSS and they fail, miserably and consistently. Less is always more in CSS, and that includes fewer classes, and less specificity in selectors. How can we select what we want without changing HTML, adding classes, or getting needlessly specific with our selectors? I'm Jen Kramer, and I've been working on the web for 19 years. Join me for my course, learning CSS selectors. This course will explain some of these newer selectors you might not be familiar with. It also includes lots of questions about selectors for you to practice on your own, including questions at the end of most videos, and a longer assessment at the end of the course, making it so much easier to work with CSS on your next site.
- 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