HTML Comments
Learn how to add comments to your HTML code. Comments are essential for documenting your code and making it more understandable.
Leaving Notes in Your Code 📝
HTML comments are notes you can leave in your code. They are completely ignored by the browser, so they are only visible to developers who look at the code. Let's learn how to write them!
Syntax
The syntax for an HTML comment is to wrap your text within <!--
and -->
. The browser will not display anything inside these markers.
Purpose of Comments
- Leave notes for yourself or other developers to clarify complex parts of the code.
- Temporarily hide or "comment out" blocks of HTML code during development or debugging without deleting them.
- Add information like author details or version history directly within the file.
Practice Zone
Practice Example: Code Editor
Write a paragraph and then add a comment below it that says "This is the main content section."