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

What's the point of the re-ordering that Nick did (besides readability)?

I understand that in CSS rules that are declared latest will override earlier ones; however, wouldn't the rule have to be for the same thing?

In other words, if we were to declare like a {color:white}; and then down the .css file declare a{color:black}; then that would override it.

However, would that happen if we were to declare like body/header/h1,h2/nav etc in different orders?

2 Answers

Justin Goldby
seal-mask
.a{fill-rule:evenodd;}techdegree
Justin Goldby
Full Stack JavaScript Techdegree Student 12,754 Points

The order you place the css selectors doesn't matter, so yea it really is just for readability, but the good thing about treehouse is they teach you a lot of those little tid bits that can make you more employable, and a better overall coder. Logically it makes sense to style elements in the same flow as the page, it's a good habit to get into!

Mandaar Dahale
Mandaar Dahale
2,527 Points

.css overrides values but if the values are provided for same property or element, so organizing style elements in css is beneficial as it separates style codes given for certain parts of site like header, footer, body, logos, links (anchors) etc.