HTML Comments

Adding Comments to Your Code

Comments are used to add notes in your HTML code. They are not displayed in the browser.

Comments help you and other developers understand your code.

<!-- This is a single-line comment -->

<!--
  This is a
  multi-line comment
  that spans several lines
-->

<h1>Visible Heading</h1>
<!-- <p>This paragraph is commented out and won't display</p> -->
<p>This paragraph will display</p>

Try Comments

<!-- Page Header -->
<h1>My Website</h1>

<!-- Main Content Section -->
<p>This is visible content.</p>

<!-- TODO: Add more content here -->

<!-- Temporarily disabled
<p>This won't show up</p>
<p>Neither will this</p>
-->

Note: Use comments to explain complex code, mark sections, or temporarily disable code during development.