Home HTML Tutorial for beginners 9 HTML Comments

9 HTML Comments


HTML comments can not be displayed on browser output. It helps programmer to add description, reminders and other notes with in a program so that it can make a complex program simple and some times help in debugging or later on modifications.

An HTML comment starts with <!– and ends with –>. An HTML comment can be a complete line, more then one line or a part of a line.

Comments can also be used to identify the starting of an article and ending of an article.

We will write an example to demonstrate the comment tag.

<title> Program to demonstrate comment tag. </title>
<!-- Single Line Comment -->
<-- Multiple line comments
Multiple Line Comments
Multiple Line Comments -->
This demonstrates commenting <-- The middle of a line -->

Note : There is an exclamation mark (!) in the opening tag, but not in the closing tag.

Check your progress :

Q) We can put comment before starting of an element to identify it.

  • True
  • False

Q) Comment can be a single line comment or multiple line comment.

  • True
  • False



Please enter your comment!
Please enter your name here