How to Comment in HTML

Comments are essential part of every programming language. Comment tags are also available in HTML and CSS. The comment tags will not be displayed on a webpage. Comment tags are used to insert user comments in a source code. You can write comments in HTML for explaining the code, defining one or more particular areas of coding and separating them in case of large programming files. This will help you a lot when you are editing or simply reviewing the source code later. Here we will show you how to insert comment in HTML and how it works.


Step # 1 – Insert the Comment Tag

Comments in html are inserted in the source code to place comments. Comments are basically used to explain something about your code.
When you open up the file, comments are not displayed as they are only used with a source code for backend programming. Here let’s open up the source file and insert your comments enclosed with “” tags.
When you write a comment in HTML, it will be displayed in green color so that they can be easily identified.

Writing comments in HTML

Step # 2 – Save your Settings

Once you have inserted comments in the HTML source code, go to the “File” menu and click on the “Save” option. This will save all your changes which you have made in the HTML source code.

Save your changes

Step # 3 – Display the HTML page on a Web Browser

Now in the last step, open up the HTML page in a Web Browser. When it is opened up, you cannot find the comments which you have inserted in the page however it is available in the source code.

View the HTML page