• Tutorial List

HTML Comments

Last updated Jul 08, 2020
HTML Comments, How to write comment in HTML

What is Comment in HTML?

HTML comments are used to describe any line of code, and it is not displayed in the browser output, but it will appear on the view page source.


Why use comments?

As we know that comments describe your code, so when you work with other developers in the same project it helps other developers to understand your code.


How to write comment in HTML?

The HTML Comment start with <!-- and end with -->. And the content between these tags is considered as a comment.

<!-- this is a comment -->

Examples of HTML Comments –

<!-- Users List -->
<ul>
  <li>John</li>
  <li>Barry</li>
  <li>Mark</li>
</ul>
<!-- End of the users list -->

<!-- 
The following paragraph will not be displayed,
because it is inside the comment section.

<p>Hello World!</p>
-->

Ask Questions

Your email address will not be published. Required fields are marked *