Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Why we include color of wrapper in the same rule, but not for anchor?
Nick puts the background color declaration under the same rule within the wrapper selector under the GENERAL section, but then he separates the anchor selector into two sections, one more text-decoration under the GENERAL section, one for color under the COLOR section. Why the inconsistency?
David Bath25,939 Points
It looks to me like he keeps all color definitions together in the Colors section. It doesn't necessarily need to be this way, but the idea is to make sure that your stylesheets are organized. Having a separate section just for colors (for instance) makes it easy, when you need to edit a large spreadsheet, to find what you are looking for. And of course comments help to find each section.
Another thing he is doing that I don't think he mentioned clearly in the video is putting selectors within a section in source order; That is, the order that they appear within a page. So for instance under Colors he first puts the body tag, then header, then nav, etc.
nico dev20,364 Points
If I may add something else, after thinking on your question and looking at the code: the 'text-decoration' is not providing any color to the anchor, it's just removing the underlining out of it. So, just as David explained, all color rules are under the Colors section. Thus, I don't think we have any inconsistency, instead, it seems like a very organized and categorized prioritization (does that word exist in English?) within the CSS file.
So, the criteria to create declarations is not only the selector (like anchor in this case), but first of all, "format," "color," etc., and then (only then) each selector.
Hope I understood that correctly and this helped you :)