HTML Comment


In this tutorial, you will learn how to make some useful comments on HTML documents.


A comment is any additional helpful information or note in an HTML document that will not be displayed in the browser but will be in the HTML code. Comment tags are used to add comments to HTML documents.

Example of Comment tag:

<!– This is a sample comment –>
Code Example:
<!-- 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 for testing.</p>
Note : There is an exclamation sign (!) in the opening tag, but not in the closing tag.

Multi-line HTML Comments

You can use multiple lines to add large comments using the same tag. See examples of multi-line comments below:

Code Example:
<html>
<head>
	<title>Multiline Comments Testing</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 some sample text.</p>
</body>
</html>

Conditional Comments

Conditional comments only define HTML tags edited by Internet Explorer.

Code Example:
<!--[if IE 8]>
    .... some HTML or code here only for Internet Explorer ....
<![endif]-->