HTML Comments

 

To help you identify different sections within the HTML coding, we add comments that help identify the various parts of the web page like the header area, the navigation group, a slideshow block, or a footer. This can help when you are looking for a specific area of coding that you need to tweak or modify.

html
  1. <!-- ==== Begin Navigation ==== -->
  2. <nav id="mainnav">
  3. .....
  4. </nav>

The <!-- --> part (and the text contained within) is the HTML comment. It is a convenient way to add notes into the code. These comments will not display when the HTML is rendered by the browser.

In the example below, you can add comments to signify opening and closing div tag pairs. It is very helpful when you have a lot of nested divs and don't want to lose track of each set's opening and closing tags.

html
  1. <div id="class name"> <!-- OPEN div tag -->
    <p>Stuff</p>
    </div> <!-- END div tag -->

I will frequently add comments to my coding while I'm working. Once the page is done, previews well in the various browsers, and contains no surprises, I will delete the comments before I upload the page to the server.