The comment start tag (<!--
) and end tag (-->
) are used to add comments to the HTML pages. Adding comments to your HTML codes is a good practice. It can help you easily understand each line of code in HTML.
Add Comments in HTML
A comment is useful to define the use of the code in HTML. A well-commented code is useful when the new user wants to work on it. Comments can make it easier to quickly understand the code and start working continuously.
1 2 3 |
<!-- This is a comment in HTML --> <p>This is a paragraph</p> <!-- It will not display in any browser --> |
Single Line Comment in HTML
A single-line comment is useful to hide a single line in HTML code.
1 2 3 |
<p>This is a paragraph</p> <!-- <p>You will not be able to see this paragraph</p> --> <p>This is a second paragraph</p> |
Inline Comment in HTML
You can add inline comments to hide the content of the inner HTML code.
1 |
<p>This is a <!--text--> first paragraph</p> |
Multiline Comments in HTML
A multiline comment is useful for adding multiline hidden content in HTML code. It is useful to add hidden detailed descriptions of the HTML code.
1 2 3 4 5 |
<p>This is a paragraph</p> <!-- This is a multiline comment in HTML --> <p>This is a second paragraph</p> |