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 Introduction to HTML and CSS Make It Beautiful With CSS Select and Style Multiple Elements by Class

Amandeep Pasricha
Amandeep Pasricha
14,932 Points

Why isn't the head tag indented after the HTML tag?

I'm just thinking big picture. The head and body box are inside of the HTML box, so shouldn't the head tag be indented after the HTML tag in the HTML document?

2 Answers

That's because you treat these tags as equal.

For example, in the body, if you have two unordered lists, your HTML will be something like this.

<ul>
  <li>List Item #1</li>
  <li>List Item #2</li>
</ul>

<ul>
  <li>List Item #3</li>
  <li>List Item #4</li>
</ul>

You don't want to indent your second unordered list because you know these tags or lists are treated as equal, so it's easier for you to read. If you indent it, you will believe for a second, that this UL is inside the other one, and that's not truth :P

Michal Svačina
Michal Svačina
5,089 Points

Actually they should be from the concept of things, but a lot of people don't do it because it is a little bit unnecessary. You do not really have to do the indentation at all, even though it would be really hard to read the code it will still work.