From the course: CSS: Selectors
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Understanding :not
- [Instructor] The not sudo class is super, super handy. It's going to allow you to select things which do not meet a certain criteria. For example, here on this web page, you'll notice that we have two images. One of these images is coded correctly in the HTML in that it has its alt tag. But the second image does not have its alt tag. So let's say you're debugging your site and you need to quickly identify which of your images does not have an alt tag. We can write a wonderful selector to do that. In this case we're going to say, for all of the image tags, let's not select those that are missing. Basically we're saying the ones that do not have the alt attribute. We don't need to test for a value, we just want to test for a presence or absence of that alt attribute. Five pixels, solid orange border around those images. And if we go ahead and do that, you'll see here we have selected the one kitten picture that is indeed missing its alt tag. So this is very helpful for debugging, now…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.