HTML Comments
HTML Comments
HTML comments are used to add notes or explanations in your code. Comments are not displayed in the browser and are ignored by It.
Syntax of HTML Comment
Single-Line Comment
Multi-Line Comment
Commenting Out HTML Code
You can disable code temporarily using comments.
Comments Inside Structure
Incorrect Usage (Avoid ❌)
Important Points to Remember
-
Comments start with
<!--and end with--> -
Do not nest comments
-
Comments are visible in page source
-
Useful for debugging and documentation
Best Practice Tips ✅
✔ Use comments to explain complex code
✔ Remove unnecessary comments in production
❌ Never write sensitive information in comments
