Comments are notes in your code that the browser does not show on the page.
Syntax
A comment starts with <!-- and ends with -->. Everything in between is ignored by the browser.
When to use comments
- To explain a tricky part of the page for yourself or your team.
- To mark where sections start and end in a long page.
- To temporarily hide some HTML while testing, without deleting it.
Warning: Comments are hidden on the page but anyone can read them with "View Source". Never put passwords or private notes in comments.
Example
Example — Single and multi-line comments
HTML
<!-- This is a single-line comment -->
<p>This paragraph is visible.</p>
<!--
This is a comment
over several lines.
-->
<!-- <p>This paragraph is hidden while testing.</p> -->
<p>Only two paragraphs appear on the page.</p>