:not()
noun
say it: “KOH-lun NOT” /ˈkoʊlən nɒt/
A pseudo-class that matches elements that don't match the selector in its parentheses, such as li:not(:last-child): every list item but the last.
What does :not() do?
:not() matches elements that do not match the selector inside it.
.menu li:not(:last-child) { border-right: 1px solid #ccc; }
In a sentence
- “I drew a line under every song with :not(), leaving out the last one so the list didn't end with a stray line.”
Level: Freelancer · More CSS terms at this level
Updated