HTML comments are notes that you add in your code but do not show up on the webpage. They are useful for explaining sections, leaving reminders, or temporarily disabling code while testing. Comments help you and other developers understand the structure and purpose of different parts of a page.
<!-- and end with -->.<head>, <body>, or nested inside elements like <div>.The basic syntax for an HTML comment looks like this: <!-- this is a comment -->. Anything between the opening <!-- and closing --> will not appear on the page.
You can use comments to:
<!-- TODO: ... --> reminders for future improvements.Here is an example of using comments in HTML:
<!-- This is a single-line comment -->
<p>This is a visible paragraph.</p>
<!-- The paragraph below is commented out and won’t be shown -->
<!-- <p>This paragraph is hidden from view.</p> -->
<p>Another visible paragraph.</p>
This is a visible paragraph.
Another visible paragraph.
The commented paragraph does not appear in the output. It still exists in the source code but is ignored by the browser, which makes comments perfect for testing or hiding content temporarily.
<!-- Header --> or <!-- Footer -->.<!-- TODO: ... --> to track future tasks or improvements in your HTML.<!-- Navigation -->, <!-- Main Content -->, and <!-- Footer --> to your existing HTML page.<!-- TODO: ... --> reminder in your HTML project for a feature you plan to add later.HTML comments are invisible notes that live inside your code but not on the page. They help you organize, document, and safely experiment with your HTML. By using the <!-- ... --> syntax wisely, you make your projects easier to understand and maintain— both for yourself and for anyone else reading your code.