ASWCode Tutorials

Learn Web Development - From Basics to Advanced

HTML Comments and Spacing

In this lesson, you’ll learn how to add comments (notes that don’t show on the webpage) and how to add spaces or lines between your content. These are small but very useful parts of HTML!

1. HTML Comments

Comments are notes you can write inside your HTML code. They don’t appear on the webpage - only developers can see them when viewing the code.

Comments start with <!-- and end with -->.

<!-- This is a comment -->
<p>This is visible on the page.</p>
<!-- Comments help explain your code to others (and yourself)! -->
      

2. Line Breaks: <br>

The <br> tag adds a single line break - like pressing "Enter" once in a document.

<p>Hello<br>Welcome to ASWCode!</p>
      
Hello
Welcome to ASWCode!

3. Horizontal Line: <hr>

The <hr> tag creates a horizontal line across the page.

<p>This is above the line.</p>
<hr>
<p>This is below the line.</p>
      

This is above the line.


This is below the line.

4. Extra Spaces

HTML ignores extra spaces. Use &nbsp; to add manual spacing.

<p>Hello&nbsp;&nbsp;&nbsp;ASWCode!</p>
      
Hello ASWCode!

Next Lesson → HTML Lists (Ordered & Unordered)

Previous Lesson → HTML Attributes

← Back