HTML Comments

In this HTML tutorial, you will learn all that is meant by Comments in HTML. We will also discuss how to use comments in HTML.

What is meant by Comments in HTML?

A comment is a chunk of code that every web browser ignores. It's a good idea to include comments in your HTML code to identify portions of a page and any additional remarks to anyone reading the code, especially in complicated texts. Comments improve code readability and help you and others comprehend your code. 

Between “<!-- -->” tags, HTML comments are put. As a result, any material included within the “<!--  -->” markers will be interpreted as a comment and will be completely ignored.

How to Add Comment to HTML Document?

Comments are text or code that is written in your script to explain the program but is not visible to the user. Comments in any code make it easier to comprehend the code and make it more readable. Using the “<! --  -->” element, you may add comments to your HTML file. If you write anything between these comment tags, it will be considered as a comment and will not be viewed by the browser.

Syntax


<!—The comment goes here -->
 

How to Add Comment to HTML Document?


<!DOCTYPE html>
<html>
<body>
 <p>Welcome to learnetutorials.com </p> <!-- our website -->
</body>
</html>
 

Output:


Welcome to learnetutorials.com

How to use Multiline Comment in HTML?

We may also comment numerous lines at once in HTML code. We may use any description of code or multiple line codes to debug in a multiline comment. Multiple lines can be commented using the special beginning tag placed before the first line and after the last line respectively.

How to Add Comment to HTML Document?


<!DOCTYPE html>
<html>
<body>
 <p>Welcome to learnetutorials.com </p> 
 <!-- Here we area
  discussing 
  about the 
  multi line comment-->
</body>
</html>
 

Output:


Welcome to learnetutorials.com