Indents in Code


#1

I've noticed when I save and submit that the code that I wrote automatically seems to be indented to different degrees. Why hasn't this been mentioned in the lessons and how do I learn to indent?


#2

Indentation in HTML and CSS is purely personal preference, and is optional. If you chose to do it, generally people do it using 1 main rule:
Indent children
Which means code looks like this:

<!DOCTYPE html>
<html>
    <head> <!-- Head is a child of html -->
        <title></title> <!-- Title is a child of head, which is a child of html -->
    </head>
    <body> <!-- Sibling to head.  Same indentation level-->
        <p>Child of body</p> <!-- Child of body -->
    </body>
</html>

See how it works?