Comment syntax in HTML

Including comments in your code is highly recommended. They can help yourself or other developers quickly understand the code with ease. When the HTML is rendered the comments are not displayed by the browsers.


<div class="container">
   <p>I am text inside a div. I am cool!</p>
</div> <!-- .container -->

The comment above indicates it is the closing div of the container class div.

To include a comment in HTML just wrap your comment with this <!-- -->.

This post currently has no responses. What do you think?

You can use basic HTML when posting code, please turn all < characters into &lt; or > into &gt;
If the code is multi-line, use <pre><code></code></pre>

Leave a Reply

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