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 trialshaleeneejadoopat
5,456 PointsWhy use parenthesis and square brackets at the same time?
Why do the :not negation open and close parenthesis need that square brackets that have the type value of button?
2 Answers
Nathaniel Satriya
2,560 PointsIt is not that the :not
pseudo-class itself needs square brackets; it is because Guil is using an attribute selector in conjunction with the :not
pseudo-class.
Basically, Guil is telling the browser to target every element except input
elements with a type
value of "button"
.
You could also use the :not
pseudo-selector in this way:
:not(.no-style) { /*styles all elements that do not have the class "no-style"*/
background-color: blue;
}
Nathaniel Satriya
2,560 PointsI'm not sure; I like all coding and have learned to code in many languages. Web Design is honestly more fun though.
shaleeneejadoopat
5,456 Pointsshaleeneejadoopat
5,456 Pointshmmmm. Thank you :)
Nathaniel Satriya
2,560 PointsNathaniel Satriya
2,560 PointsYou're welcome!
And by the way, I am not yet very good at coding, so the code that I posted in my answer may not be 100% correct.
shaleeneejadoopat
5,456 Pointsshaleeneejadoopat
5,456 PointsNeither do I lol.... I guess that's why we're at HouseTreeHouse. What is your field of interest, Web Design or Development ?
Kevin Faust
15,353 PointsKevin Faust
15,353 Pointsim gunna slip in here and say Hello :)
Trevor Covington
9,050 PointsTrevor Covington
9,050 PointsIf you really wanted to use attribute selectors with classes you could write it like this too:
As to why do it this way, I have no idea.