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 HTML Basics Getting Started with HTML Headings and Paragraphs Challenge

Is 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
Ben Reynolds
35,170 Points

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

I appreciate it!

Are 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>