Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed CSS Selectors!
You have completed CSS Selectors!
Preview
The :not() pseudo-class is referred to as a negation pseudo-class because it selects everything except the element we specify in the selector.
Quick Reference
Using :not()
This selector targets all input elements that do not have a type value of button:
input:not([type="button"]) {
border-color: blue;
}
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
specify in the selector and we can use it
with just about any type of selector.
0:00
So for example, in our style sheet, let's
create one of these not selectors.
0:04
So if we wanna target all divs, that do
not have the ID of say, col-a.
0:09
So target all the divs on the page, except
for this div with the ID col-a.
0:17
We can do that with the not selector.
0:21
So let's create our selector by first
targeting div followed by colon and
0:24
then not then a set of parenthesis.
0:29
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up