HTML COMMENTS


Comments are something that increase the readability and documentation of the code. They are never a part of the code itself, hence, are never displayed in the browser. Commenting in HTML allows developers to leave notes about their code, its functionality or to indicate necessary changes for the future.
Comments can be written in the HTML source code using the following syntax:
<!-- Write your comments like this -->
This is a single line comment. But in some cases, multiple line comments need to be written. For that we will use the following syntax:
<!-- Multiple
Line
Comment.
-->


Example for single line comment:



<!DOCTYPE html>
<html>
<head>
<title> Writing comments in HTML </title>
</head>
<body>

<p>learning to use single line and
 multiple line comments in HTML</p>
<!-- this is a single line comment-->

</body>
</html>

Live Demo!


Example for multiple-line comment:




<!DOCTYPE html>
<html>
<head>
<title> Writing comments in HTML </title>
</head>
<body>

<p>next comment is an example of
multiple line comment</p>
<!--DO NOT add the table and the link
<a href = "filename.html">click here</a>
Here for now
-->

</body>
</html>

Live Demo!


Comments are especially useful and handy when multiple people are working on same source code and notes need to be left for others to keep them up to date about the changes and updates done.