Now comments aren’t technically required for writing HTML, but being able to add comments to our code is a really useful tool to leave notes to ourselves about what code means and what it does. Comments don’t appear on the page, and will only be visible in the source of the code that we’re writing.

Because of this, comments are a great way to leave notes for yourself, right in with the code that you’re learning! To write comments in HTML, we have an opening and closing tag again, with content inside it.

To write comments in HTML, we can wrap content inside <!-- and --> tags, like below.

<p>This is content on the page</p>

<!-- This is a comment -->

<p>This is more content</p>

Try adding a comment between the h2 and p elements in the Codepen below.

See the Pen HTML Elements - Comments on CodePen.