Join James Williamson for an in-depth discussion in this video The negation selector, part of CSS: Selectors.
- View Offline
- Exercise Files
- The negation pseudo-class selector…is one of the oddest selectors in all of CSS.…Essentially, it allows you to target everything…that doesn't match a simple selector…that you pass into it as an argument.…It's a little easier to understand…if you can see how it works.…So let's take a look at the syntax…and then we'll experiment with it.…So I've got the not.htm file…from the 04_05 directory opened up in a browser,…and the first thing I want to take a look at…are the three bullet points of sort of a…syntax example that I have here.…
So the very first example I have there…where it says :not(p),…that would match every element except for paragraphs.…The one underneath it where we're…a little more element specific,…we're saying p:not and inside of that…we're passing the attribute selector of class.…That would target every single paragraph…that doesn't have a class attribute.…And then finally underneath it,…you can see li:not, and then inside the parentheses…the pseudo-class selector of last-child.…
So that would match every item in a list…
- Targeting classes and IDs
- Working with group selectors
- Targeting element attributes
- String matching
- Targeting links with pseudo-class selectors
- Targeting child elements and empty elements
- Targeting parent, child, and sibling elements
- Matching patterns
- Writing efficient selectors
Skill Level Intermediate
CSS: Advanced Typographic Techniqueswith James Williamson3h 14m Intermediate
HTML5: Graphics and Animation with Canvaswith Joe Marini3h 7m Intermediate
1. Basic Selectors
2. Attribute Selectors
3. User Action Pseudo-Class Selectors
4. Structural Selectors
6. Matching Patterns
7. Writing Efficient 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.