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
Christopher Gregory
4,183 PointsBeginner Coder, Does my CSS look messy?
Can someone take a quick look at my CSS? https://jsfiddle.net/9xf5b6qg/ .
The form isn't finished but was wondering if my code is messy? and am I using the right selectors and what not :)
2 Answers
Grace Faires
5,435 PointsHey!
It generally looks pretty good, I'd just keep an eye on your consistency with regards to your formatting and indentation - for example, on lines 27 and 36 of your CSS your entire code block is indented, which it doesn't need to be, as a general rule, keep your selectors align to the left (like you've done for the rest of it) and only indent your declarations.
like this:
#content {
background-color: #fff;
box-shadow: 0 0 10px #444;
border-radius: 0 0 5px 5px;
color: #444;
padding: 2.5% 4%;
}
You've also got a gap on line 75 which doesn't need to be there, always make sure your declarations are underneath each other with no whitespace in between - it makes it easier if you have to look back through your code and fix any issues.
And this is just a personal preference for me, but I will always format my CSS in exactly the same way, regardless of how many lines it is, just for ease of reading and consistency.
so, like this:
body {
background-color: #f9f9f9;
}
not this:
body { background-color: #f9f9f9; }
Like I say though, that's just personal preference!
Christopher Gregory
4,183 PointsAh cheers for taking the time to reply! The line on 75 was because I removed something just before posting and forgot about it :P
Thank's for the other tips, super helpful!