HTML Basics
HTML Comments
Comments let you leave notes inside your HTML that the browser ignores and visitors never see. They are perfect for explaining code or temporarily hiding parts of a page.
What is an HTML Comment?
An HTML comment is text that the browser does not display. Developers use comments to explain what a section does, mark to-do items, or temporarily disable code without deleting it.
Comment Syntax
A comment starts with <!-- and ends with -->. Anything in between is ignored by the browser.
<!-- This is a single-line comment -->
<p>This paragraph is visible.</p>
<!--
This is a
multi-line comment.
-->
<!-- <p>This paragraph is hidden and will NOT show.</p> -->In the last line above, wrapping a real element in comment markers 'comments it out', a handy trick while debugging a page.
Comments are visible to anyone who views your page source, so never put passwords, secret keys, or private notes in HTML comments.
You cannot nest one comment inside another. Placing -- inside a comment can also cause problems, so avoid double dashes in your comment text.
