HTML Comment

Adding HTML comment properly helps in finding class or a specific section in a large page. They are added only for giving information to the given sentence or given paragraph. But it is not mandatory to add comment or you can even completely miss it.

Syntax of HTML Comment

<!-- your comment here-->   

Full code example

<!DOCTYPE html>
<html>
<head>
</head>
<body>

<h2>Heading Name</h2>
<p>
Content description
</p>
<!--end first para-->

<h2>Another Heading</h2>
<p>
Another description
</p>
<!--end second para-->

</body>
</html>
Run The code »

Output

Heading Name

Content description

Another Heading

Another description

Comments are not displayed on the web-browser and have no any visual effect on the web pages.
Generally, comment sections are green color in the editor.

The following example is wrong of using HTML comment.

<!DOCTYPE html>
<html>
<head>
</head>
<body>

<!--start first para
  <p> First para </p>

  <p> Second para </p>
end second para-->

</body>
</html>

It will not display anything on the web browser. HTML comment must strictly obey the basic syntax of defining it.