HTML - Indentation
query_builder | Christopher PisaniTo better understand the code you are writing, we use indentation on elements. Every child element, in the parent element, is usually spaced by 4 spaces / TAB. This helps code to be read by the web developers, and for debugging purposes. It should be used consistently, to follow the scripting standards. Imagine of scrolling through thousands of lines of code without indentation. This would be an absolute nightmare for another developer, or yourself, after a period of time.
Without indentation:
<!DOCTYPE html>
<html lang="en">
<head>
<title>My first web page</title>
</head>
<body>
<header>
Logo
</header>
<main>
<p>
This is a paragraph
</p>
<ul>
<li>Lesson 1</li>
<li>Lesson 2</li>
<li>Lesson 3</li>
</ul>
</main>
<footer>
Created By Jazzo.co.uk
</footer>
</body>
</html>
With indentation:
<!-- How easier is that to read the code ? -->
<!DOCTYPE html>
<html lang="en">
<head>
<title>My first web page</title>
</head>
<body>
<header>
Logo
</header>
<main>
<p>
This is a paragraph
</p>
<ul>
<li>Lesson 1</li>
<li>Lesson 2</li>
<li>Lesson 3</li>
</ul>
</main>
<footer>
Created By Jazzo.co.uk
</footer>
</body>
</html>