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 trialBridget Word
3,237 PointsIs it necessary for a blank line or space between the lines of code?
Is it necessary for a blank line or space between the lines of code?
2 Answers
Ben Reynolds
35,170 PointsNope, the browser doesn't mind either way. Code is mainly written that way for readability. Some languages handle whitespace a bit differently but html is pretty permissive. In fact a common technique to reduce file size is minification, where all the whitespace is stripped out and the code is compressed. That's a bit of a side note though, minification is explained later in one of the web design tracks in the section on optimizations.
jaredcowan
11,808 PointsAre you talking about between DOM elements? It's not required, but can be a personal preference for every developer.
Example:
<section class="comments-container">
<div class="comment-item">
My comment
</div>
<div class="comment-item">
My comment
</div>
<div class="comment-item">
My comment
</div>
</section>
Bridget Word
3,237 PointsBridget Word
3,237 PointsI appreciate it!