HTML Introduction to HTML and CSS Make It Beautiful With CSS Select and Style Multiple Elements by Class

Amandeep Pasricha
Amandeep Pasricha
14,928 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

Diego Alvarez
Diego Alvarez
2,680 Points

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.