Learn HTML by Building a Cat Photo App - Step 6

Tell us what’s happening:
Add two more spaces in front of the h2 , comment, and p elements so your HTML is more readable.

  **Your code so far**
<html>
<body>
  <h1>CatPhotoApp</h1>  
  <main>
  <h2>Cat Photos</h2>
  <!-- TODO: Add link to cat photos -->
  <p>Click here to view more cat photos.</p>
  </main>
</body>
</html>
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36

Challenge: Learn HTML by Building a Cat Photo App - Step 6

Link to the challenge:

Hello,
I took the above-mentioned code and made some changes, as shown below.

<html>
<body>
<h1>CatPhotoApp</h1>  
<main>
<h2>Cat Photos</h2>
<!-- TODO: Add link to cat photos -->
<p>Click here to view more cat photos.</p>
</main>
</body>
</html>

It is difficult to determine the contents of an element, as well as the opening and closing tags of an element, if there are no spaces. I start with the open tag and look at every line below it to find the closing tag, then I look at every line in between them to find the contents, and I repeat the process for the contents as well.

Consider the following code:

<html>
  <body>
    <h1>CatPhotoApp</h1>  
    <main>
      <h2>Cat Photos</h2>
      <!-- TODO: Add link to cat photos -->
      <p>Click here to view more cat photos.</p>
    </main>
  </body>
</html>

I can identify the opening and closing tags of an element, as well as its contents, by simply looking at the code.

Even though both of the above codes perform the same function, the code with spaces or indentation is more useful for developers.

I hope this answer helps you