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

Pieter Scholtens
1,863 PointsOrder of writing your CSS.
Hi Community,
Could someone try to explain to me if there's a certain order in writing your CSS?
I'm starting to get the hang of HTML/CSS but the only thing I still find confusing is the feel of randomness in the CSS files, for instance, jumping from styling links to divs and so on. So is there a good practice in order of writing?
Trying to explain this as good as I can, hopefully this makes any sense :) Thanks in advance.
Pieter
2 Answers

Luke Pettway
16,593 PointsWhen I am writing vanilla CSS I will just follow a top down approach, using comments I'll section parts of such as header, body, footer, sidebar, and within those segments write my code. By having some sort of planned structure, it will cut down on the randomness.

Luke Pettway
16,593 PointsCheck out how the WordPress team structured their CSS file:
https://github.com/thethemefoundry/twentytwelve/blob/master/build/style.css

Pieter Scholtens
1,863 PointsGood one, thanks!
Pieter Scholtens
1,863 PointsPieter Scholtens
1,863 PointsThanks Luke,
Yeah, I guess it just needs to become second nature after a while. But I was just wondering wether there's some sort of cheatsheet which you can use as a guideline. So if I can give a really simple example it would be something like:
Base Styles: • Header • Body • Footer
Divs?
Typography: ? • H1 • H2 • H3 • p • links
Writing it down confuses me already :) Anyway thanks for your reply!