HTML Comment Tag ( <! — This is comment –> ) is used to add comments in the HTML source code. Comments normally help the software developers to understand the purpose of source code for future references.
The comments are not displayed in the browser.
<!DOCTYPE html> <html> <body> <h4>There is a comment after this line in code.</h4> <!-- This is a comment --> <h2>This is actual Message.</h2> <!-- Comments are not displayed in the browser --> </body> </html>
Now, if we open this html webpage in browser, it can be seen as,
As you can see here, the comment tags with comments “This is a comment” and “Comments are not displayed in the browser” are not visible on webpage.
In html comments may end up in adding the size of file transferred over internet, so too many comments are also not good. So having minimum comments which serves the purpose helps.