Your Cart

Get Amazing Offers on Scripts

Get UX Support

View HTML Tutorial

HTML Comments

In HTML, comments are used to include information within the code that is not displayed when the web page is rendered in a browser. Comments can be useful for providing notes to developers, explaining code sections, or temporarily disabling code. HTML comments are enclosed between <!-- and -->. Here’s how you can use HTML comments:

Syntax:

				
					<!-- This is a comment -->

				
			

Example:

 
				
					<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>HTML Comment Example</title>
</head>
<body>

  <h1>Welcome to My Website</h1>
  <p>This is a paragraph of text.</p>

  <!-- The following div is for styling purposes -->
  <div style="background-color: lightblue; padding: 10px;">
    <p>This div has a light blue background for emphasis.</p>
  </div>

</body>
</html>

				
			
In this example, a comment is used to explain the purpose of the
element. Comments can also be used to temporarily exclude or “comment out” a piece of code for testing or debugging purposes:
				
					<!-- <p>This paragraph is temporarily commented out.</p> -->

				
			

Conclusion

Keep in mind that comments are not visible on the rendered web page, but they can be viewed by inspecting the HTML source code. Comments are a valuable tool for making your code more understandable and for leaving notes for yourself and other developers who may work on the same project.

Free Worldwide shipping

On all orders above $50

Easy 30 days returns

30 days money back guarantee

International Warranty

Offered in the country of usage

100% Secure Checkout

PayPal / MasterCard / Visa