A Complete Guide to How the CSS Not Selector Worksby@smpnjn

A Complete Guide to How the CSS Not Selector Works

tldt arrow
Read on Terminal Reader
Read this story w/o Javascript

Too Long; Didn't Read

The CSS:not()` selector is broadly supported by most browsers. It's often necessary to signpost that we want to select an element, but **not** in specific circumstances. The way it works is that we create a selector, and then specify what it should **not* be. In these instances, we can use the selector to do that. The selector also affects specificity, where certain selectors "override" others. For example, if you had `div:not(#id)` in your code, it still counts as having an `id` so the specificity increases.

Company Mentioned

Mention Thumbnail
featured image - A Complete Guide to How the CSS Not Selector Works
Johnny Simpson HackerNoon profile picture

@smpnjn

Johnny Simpson


Receive Stories from @smpnjn

react to story with heart

RELATED STORIES

L O A D I N G
. . . comments & more!