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

HTML How to Make a Website Customizing Colors and Fonts Organize CSS with Comments

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?

2 Answers

David Bath
David Bath
25,940 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 dev
nico dev
20,364 Points

Hi Anthony,

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 :)