Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialchristophe Bonge
6,618 PointsHi, problem with pseudo-class :not
when i type
div:not ([id="s1"]) {
background-color: tomato;
}
the concerned elements aren't highlighted.
christophe Bonge
6,618 PointsHi thanks Guil for your answer; I didn't pay attention to this space.
3 Answers
Paul Anderson
15,056 PointsIf you're selecting classes or id's via the :not pseudo-class you don't need to put in square brackets. Simple add the . or # before the s1. If you were selecting a type of something within that div you would use square brackets, like such [type="file"]. Hope this helps.
Sue Dough
35,800 PointsTry this
div:not(#s1) {
background-color: tomato;
}
christophe Bonge
6,618 PointsThanks for your answers; actually it works; but i don't understand why in the course Guil shows this pseudo selector with this type of syntax selector:not([id="s1"])
Guil Hernandez
Treehouse TeacherGuil Hernandez
Treehouse TeacherHi christophe Bonge,
Looks like the problem here is the space between
not
and([id="s1"])
. Like Paul Anderson mentioned, you can also omit the square brackets and attribute.