Skip to content
Related Articles

Related Articles

How to write comments in HTML ?

View Discussion
Improve Article
Save Article
  • Last Updated : 31 May, 2022
View Discussion
Improve Article
Save Article

In this article, we have to pass a comment for an HTML by using <!– Comment –> tag. In html, we can add single-line comments and multi-line comments. These are used to insert comments in the HTML code. It is helpful to understand complex code. The comment tag is useful during the debugging of the codes.
Syntax: Single line comment

<!-- Comments here -->

Syntax: Multi line comment

<!-- 
 This is 
multi line
comments. 
-->

Example: The following code illustrates a single line comment.




<!DOCTYPE html>
<html>
 
<body>
    <h2>
        GeeksForGeeks
    </h2>
    <!-- single line comment -->
 
    <h2>
        HTML5: How to comment HTML tags?
 
    </h2>
    <!-- Paragraph element -->
     
<p>GeeksforGeeks</p>
 
</body>
 
</html>

Output:

Example 2: The following code illustrates the multi line comment.




<!DOCTYPE html>                                           
<html>
  
<body>
    <h2>
        GeeksForGeeks
    </h2>
        <!-- Multi line comment -->
    <h2>
        HTML5: How to comment HTML tags?
    </h2>
        
    <!-- The multi-line comment is useful
        to comment multiple lines
            
        Paragraph element  -->
            
     
<p>GeeksforGeeks </p>
 
 
     
<p>
        It is a Good platform For
        Computer science students
    </p>
 
</body>
  
</html>

Output:


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!