HTML Comments

HTML Comments are not rendered by browsers. They serve to present an additional information to the programmer.

Example

The following example demonstrates how HTML Comments are used.

index.html

</>
Copy
<!DOCTYPE html>
<html>
<head>
</head>
<body>
 
  <!-- This is a comment -->
  
</body>
</html>

Note that a HTML comment starts with a left angular bracket, then an exclamation mark followed by two hyphens. No space between these characters. Then we write the comment and close the comment by writing two hyphens followed by right angular bracket.

Usage of HTML Comments

Comments are usually kept at places to provide an information to self or other users/developers.

In the following example, there is a simple comment about paragraph.

index.html

<!DOCTYPE html>
<html>
<head>
</head>
<body>
 
  <!-- Description -->
  <p>Hello World!</p>
  
</body>
</html>