Table of Contents

HTML Comments

HTML Comments are used to leave yourself notes through your code. Comments will never be rendered on the screen. To add a comment in your HTML you will start your comment with <!-- and end it with -->. Take a look at the following example comment:

<!-- I'm an HTML comment -->

You can also use comments to debug your code or comment out HTML that you do not want to display. The following example will comment out the second paragraph:

<p>I'm the first paragraph</p>
<!-- commenting out second paragraph
  <p>I'm the second paragraph</p>

The code above will have the following result:

HTML Comment Example:

As you can see only the first pargraph is displayed in the example above. And that's because we have commented out the second paragraph. Feel free to leave yourselves plenty of comments in your code. This will make your code more readable and enjoyable to work with.