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 trial

CSS CSS Basics (2014) Basic Selectors Basic Selectors Review

Which selectors have the most specificity and carry the most weight?

im stuck here guys !!???

4 Answers

The 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.

With 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
Erin Waldie
Courses Plus Student 4,419 Points

This answer with the tip above explained the scenario better than the video. Thank-you.

No problem, Erin - really pleased to have helped! :+1: :smile:

Qasa Lee
Qasa Lee
18,916 Points

The answer should be ID selector, however , Mr.Steve's words are pretty bright?

Camila N
Camila N
10,677 Points

Hi! 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.

ID selectors