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 trialBryan Ramirez
15,089 PointsWhich selectors have the most specificity and carry the most weight?
im stuck here guys !!???
4 Answers
Steve Hunter
57,712 PointsThe most specificity is given to those styles written in the HTML file itself, perhaps even in the html tag.
I'll run through the quiz and see what the answer should be ... back in a sec
Steve.
Qasa Lee
18,916 PointsThe answer should be ID selector, however , Mr.Steve's words are pretty bright?
Camila N
10,677 PointsHi! This is nicely explained in detail in this blog post from CSS tricks (I recommend it to everyone interested in front end evelopment): https://css-tricks.com/specifics-on-css-specificity/
Basically, it's a matter of points.
Fortune Venekerai Gumbo
5,138 PointsID selectors
Steve Hunter
57,712 PointsSteve Hunter
57,712 PointsWith those options, it is the ID selector that is most specific. That is because there can be only one ID per page, whereas a class with the same name can be used in multiple tags.
Erin Waldie
Courses Plus Student 4,419 PointsErin Waldie
Courses Plus Student 4,419 PointsThis answer with the tip above explained the scenario better than the video. Thank-you.
Steve Hunter
57,712 PointsSteve Hunter
57,712 PointsNo problem, Erin - really pleased to have helped!