The comment tag is used to insert comments in the code of your document. Comment tags help us to provide description or explanation of our code, which can be helpful when we edit the source code later. In HTML, anything written between the <!-- and --> tags is taken as a comment by the Web browser. These comments are ignored by the Web browser and are not displayed on the HTML page.
For HTML Comments, tag <!-- ..comments.. --> are used to insert comments in HTML
Following is the syntax to add comments in your HTML documents:
<!-- Write comments here -->
Here is an example uses comment in HTML document:
<!DOCTYPE html> <html> <head> <title>HTML Comments Example</title> </head> <body> <!-- This is a comment --> <p>HTML Comments</p> <!-- this is also a comments --> <p>This is HTML Comments Example</p> <!-- Comments are not displayed in the browser --> </body> </html>
Here is the sample output produced by the above HTML comment example code: