HTML Comments

The Comments Tag in HTML is used for several reasons such as:

  • Give information as to why you are using a particular set of tags and what you intend them to display in the page.
  • Reminders on what needs to be further input into the page, perhaps at a later time.
  • If you are going to be using Scripting languages(java script,JSP etc.), you need to use comments because such languages require comments to be placed.

Unlike other tags, the comment tag does not have a closing tag.

<! begins the comment and > closes it. Whatever is put in between is the actual comment.


<h1>This is a heading</h1> 
<! This is a comment line and will not be displayed by the browser>

The result of the following code is:

This is a heading

Comments are not displayed in the web page.The browser ignores them but comments are useful for the programmer.

Comments on this entry are closed.