HTML Comments

Comments are the text or code written in your code to give an explanation about the code, It will not be visible to user. Anything written between comment tag browser will ignore it, so comments will not be visible of the webpage.

Uses of comments:

1] Comments of any code make code easy to understand and increase the readability of code.

2] Comments gives the explanation of the code.

How to add comment in HTML:

You can add comments in your HTML file using <!-- --> tag. So if you write anything between <!-- --> tag that will be treated as comment and browser will not read it.

Syntax:

<!-- Write comment text here -->

Browser will not read the conent within comment tag, so browser will ignore below tags.

<!-- <div> This is the first example of comment in HTML<div>

<div> This is the second example of comment in HTML</div> -->

Example
<!DOCTYPE html>  
<html>  
<head>  
<!-- Internal CSS -->  
<style>  
  body{  
  text-align: center;  
  background-color: #f0f8ff;  
  font-size: 30px;  
  color: red;  
  }  
</style>  
</head>   
<body>  
<!-- heading tag -->  
 <h2>This is the heading tag</h2>    
 <!-- Paragraph tag -->  
 <p>This is the paragrap tag</p>  
</body>  
</html>

In above example we have comments, it specifies the code readability and understanding of code.

Multiline comment:

In HTML code, we also comment multiple lines at a time. In multiline comment we can comment multiple lines. so browser will not execute these lines.

Example
<!DOCTYPE html>  
<html>  
<head>      
</head>   
<body> 
 <h2>Cake Gallery</h2>  
<!-- This is image of quote  
you can see it on your web-page  
of your favorite browser -->  
<img src="quote.png" alt="quote image" height="300px"  
 width="300px">  
</body>
</html>