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 trialAnil Basaran
Front End Web Development Techdegree Student 3,167 Pointsin the last example we use a[target="_blank] we don't really need the "a" though right?
its very improbable to have a target attribute which is equal to "_blank" rather than anchor element so i guess and we can just use [target="_blank] right?
1 Answer
Steven Parker
231,269 PointsYou need to balance the quotes, but yes, it's unlikely for that attribute selector alone to match anything but anchors. But including the "a" makes sense because you do, in fact, want to target anchor elements, just only those with that attribute.
It also gives the selector higher specificity so it would get priority over a later rule that targets just anchors.