Comment


HTML Comments are not displayed on the web browser, but that will help you for the documentation of your web pages.

Syntax :-

<!- - write your comments here - - >
Example :


<!DOCTYPE HTML>


<html>


<head>


<title> Comment Tag</title>


</head>


<body>


            <! -- This is first paragraph -->


<p> This is a example of comment tag</p>


</body>


</html>






Output :
Now, you can see in this output, comment are not displayed by the browser, but they can help to document your HTML file.


Types of Comment


1. Single Line Comment
2. Multi Line Comment
3. Conditional Comment

1. Single Line Comment :
When commented on only one line in an HTML document, it is called a Single Line Comment.

Syntax :-

<!- - write your single line comment here - - >

2. Multi Line Comment :

When a comment is made on more than one line in an HTML document, it is called a Multi Line Comment.

Syntax :-



<! - write your multi line comment here..


This is a example of multi line comment .


This is paragraph. ->


3. Conditional Comment :

These types of comments are written for Internet Explorer Browser.  Conditional Comments run on only explorer browser.

Example :

<!DOCTYPE HTML>

<html>

<head>

<title> Comment Tag</title>

</head>

<body>

            <! - -  [ if IE 8 ] >

          Your browser doesn't support this format.

         <! [endif]- ->



<p>conditional comment work only on internet explorer. </p>

</body>

</html>

Output :