HTML5

HTML Comments


Comment tags are used to insert comments in the HTML source code.


HTML comment tags

This element is different than other HTML elements. You can add comments to your HTML source code by using the following syntax:

<!-- Write your comments here -->

Notice that there is an exclamation point (!) in the opening tag, but not in the closing tag.


Commenting is a way that you can leave notes to yourself or other developers who read your code. Comments are not displayed by the browser, but they can help document your HTML source code.

<!-- This is a comment -->

<p>This is a paragraph.</p>

<!-- Remember to add more information here -->

Why do we need comments in HTML

When you start creating websites. Your projects get so big that sometimes it’s hard to manage. İt will be really hard to know which element is which. The properly commented HTML markup is an important part of a well-built web page. Those comments are easy to add, and anyone having to work on that site’s code in the future (including yourself or members of any team you work with) will thank you for those comments.


İf you are a visual person. Here is a video showing how to create comments.