Answer
HTML Comments are not displayed on a web page and are useful in documenting source code.
A comment starts with <!--
and ends with -->
as shown below.
List Type | Description |
Single line comment | A comment that starts and ends on the same line. |
Multiple line comment | A comment that can extend to multiple lines. |
Inline comment | A comment that exists within the content of an element. |
Example
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1>HTML Comments</h1>
<!-- Single line comment -->
<!--
Multiple line comment
that extend to multiple lines
-->
<p>This paragraph contains <!-- inline comment goes here --> an inline comment.</p>
</body>
</html>
In the below example, we have used all the different types of comments.