HTML Comments

Comments are text or code written in a code that is not visible to the user but is used to explain the code to make it easy to understand and increase its readability. The Comment tags are used to insert comments in the source code in HTML.

Syntax:

<!-- Comments -->

Example:

<!DOCTYPE html>
<html>
<body>
<!-- HTML Paragraph tag -->
<p>Hello World!!</p>
</body>
</html>

Explanation:

In the above example, comments are added in the code to make the code easy to understand but comments are not displayed on the browser.

Multiline Comments:

The same syntax can be used for both single-line and multiple-line comments in HTML.
Example:

<!DOCTYPE html>
<html>
<body>
<!-- This is an example to display
a text on browser using HTML. 
HTML Paragraph tag -->
<p>Hello World!!</p>
</body>
</html>

 

Explanation:

In the above example, comments are added to the code to make the code easy to understand. However, comments are not displayed on the browser.