Indentation
In the previous exercise, we explained nesting. Now let's look at a tool for writing more readable code - indentation.
Indentation does not affect the functionality of the code, but that doesn't mean it shouldn't be followed. On the contrary, because it makes the code more readable for other developers, it is a powerful tool that every developer should master.
<html>
<head>
</head>
<body>
<p>Hello!</p>
</body>
</html>
In the example above, the head
and body
elements are children of the html
element, so they are indented with a tab character (four spaces). The p
element is a child of the body
element, so it is indented with another tab character (four spaces).
Indentation can also be done with two spaces, just make sure the indentation is consistent.
Instructions
Fix the indentation of the elements.
Start programming for free
5/9