In HTML, comments let you leave notes and explanations for yourself or other developers when working on a webpage. They can also be used to disable certain code while you're experimenting or working on an incomplete feature. Learning the proper way to comment will help improve the efficiency of your coding process for both you and your colleagues.
Steps

Insert a single line comment. Comments are indicated by the <!-- and --> tags. You can quickly add a comment to remind yourself about an issue in the code.
<html> <head> <title>Comment Test</title> </head> <body> <!-- This code creates a paragraph text --> <p>This is a website</p> </body> </html>
- Ensure there are no spaces between the comment tags. For example, < !-- won't activate the comment feature. Inside the comment tags, you can add as many spaces as needed.

Create multi-line comments. Your comment can span multiple lines, which is useful for explaining complex code or temporarily disabling large blocks of code.
<html> <head> <title>Comment Experiment</title> </head> <body> <!-- Comments can be as long as needed. Everything inside the comment tags does not affect the code on the webpage. --> <p>This is a website</p> </body> </html>

Use the comment feature to quickly disable a section of code. If you're debugging or want to prevent certain code from running on the website, you can use comments to disable it quickly. To restore the code, simply remove the comment tags.
<html> <head> <title>Comment Test</title> </head> <body> <p>View this message</p> <img src="/images/image1.jpg"> <!-- Hide this image right now <img src="/images/image2.jpg"> --> </body> </html>

Use comments to hide scripts in browsers that do not support Java. If you're working with JavaScript or VBScript, you can use comments to hide scripts in browsers that don't support them. To do this, insert a comment tag at the start of the script and end it with the //--> tag to ensure that the script runs only on browsers that do support it.
<html> <head> <title>VBScript</title> </head> <body> <script language="vbscript" type="text/vbscript"> <!-- document.write("Hello World!") //--> </script> </body> </html>
- The // at the end of the comment tag prevents the script from executing the comment feature if the browser supports it.
Tips
- Using comments is a good habit in programming because it helps you remember how everything works and makes it easier to return to your code later.
