Why Use Comments?
Comments let you leave notes inside your markup that are completely ignored by the browser. They are useful for explaining tricky sections, leaving reminders, or temporarily disabling a block of code.
Commenting Out Code
Comments are handy for temporarily removing a section of markup while testing, without deleting it entirely.
Disabling a Section
<!--
<section class="promo">
<h2>Limited Time Offer</h2>
</section>
-->Output
No Nested Comments
HTML comments cannot be nested. Placing <!-- --> inside another comment will close the outer comment early and can produce unexpected markup.
Best Practice
Use comments sparingly and only where the intent of a block of markup isn’t obvious. Well-structured, semantic HTML usually needs very few comments.
Comment Syntax