Code Snippet

Home » Code Snippets » HTML » Comments in HTML

Comments in HTML

<div id="header">
   <p>Stuff</p>
</div> <!-- END div-header -->

The <!-- --> stuff is the HTML comment. It is a way to add notes into the code which will not display when the HTML is rendered by the browser. In the example above, to signify which opening div tag the closing tag was actually closing.

Subscribe to The Thread

  1. That’s awesome Bro, will this work as a comment box ?
    Much appreciated.

    Watkinsservices@live.com

    Thanks again,
    -Joe

  2. Grant

    Hey @Joshephy Watkins

    If you are talking about a comment box like what I typed this message in, it won’t. It will just put a note in the HTML code for you to use later (I usually go stuf…… To keep everything organized

  3. Seein how this works

  4. thanks it’s nice

  5. Cool trick, I will def give it a try, thank you for sharing.

  6. thank u.

  7. html comments are particularly useful if you edit a page and you want to find your changes fast. The more detailed these comments are, the better…

    Stamatis – Ygraeriokinisi

  8. Too bad html editors like Notepad++ can’t handle easy comment-block adding like in the case of JS comments, when you can add them easily by selecting the code and using a shortcut key combination.

Speak, my friend

At this moment, you have an awesome opportunity* to be the person your mother always wanted you to be: kind, helpful, and smart. Do that, and we'll give you a big ol' gold star for the day (literally).

Posting tips:
  • You can use basic HTML
  • When posting code, please turn all
    < characters into &lt;
  • If the code is multi-line, use
    <pre><code></code></pre>
Thank you,
~ The Management ~