HTML Comment tags are used to insert some useful comments in the HTML document.
Anything you write inside Comment tags will be ignored by the web browser and it will not show any output to the user. Comments are very helpful for programmers. Using HTML Comments, you can add some useful descriptions of some code. They help you understand your code and increases code readability later.
<!-- This is a sample comment -->
<!-- Add any comment about following paragraph --> <p>This is a first paragraph.</p> <!-- This comment will tell something about following paragraph --> <p>This is a another paragraph.</p>
Complete HTML Program with Multi-line HTML Comments
You can simply use multiple lines to add large comments using the same tags.
<!DOCTYPE html> <html> <head> <title>Multiline Comments</title> </head> <body> <!-- This is a multiline comment and you can add some description about the following code so that it will be helpful for others. --> <p>This is Sample Content</p> </body> </html>
Conditional comments only work in Internet Explorer (IE) on Windows but they are ignored by other browsers.
<!DOCTYPE html> <html> <head> <title>Conditional Comments</title> <!--[if IE 8]> Special instructions for IE 8 here <![endif]--> </head> <body> <p>This is Sample Content</p> </body> </html>