1. HTML Comments

Definition

HTML comments are used to add notes or explanations inside HTML code.
They are not displayed in the browser.

Comments help:

  • Developers understand the code
  • Temporarily disable code
  • Improve readability

Syntax

<!-- This is a comment -->

Example

<p>This text is visible</p>

<!-- This text will not appear on the webpage -->

<p>This is another paragraph</p>

Output

Only this will be shown:

This text is visible

This is another paragraph

Uses of HTML Comments

  • Explaining code
  • Debugging
  • Hiding content temporarily
  • Team collaboration

Important Points

  • Comments start with <!-- and end with -->
  • They do not affect page output
  • Cannot be nested