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.

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,741 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.