How to make an HTML comment is one of the easiest questions for anyone just starting to learn markup. HTML comments do not appear on the page, but they help explain code, temporarily hide fragments, and keep a document better organized.
What an HTML comment is
An HTML comment is a special piece of code that the browser ignores when rendering a page. It is used for developer notes, code explanations, or temporarily disabling elements without deleting them.
In real projects, HTML comments are especially useful in long files, where you need to quickly understand what a block does or leave a note for yourself or a teammate.
How to make an HTML comment
How to make an HTML comment correctly is shown by the basic syntax: <!– your comment –>.
Anything placed between the opening <!– and closing –> markers will not be shown to the user. For example:
<!– This is a comment that is not visible on the page –>
You can place this form in almost any part of an HTML document, as long as it does not break the surrounding tag structure.
Where to use HTML comments
HTML comments are best used for a few practical tasks.
- Explaining code blocks for yourself or your team.
- Temporarily disabling an element without deleting it.
- Marking the beginning and end of large page sections.
- Leaving reminders for future edits.
For example, when testing a layout, you can comment out a banner, button, or entire block and bring it back later in seconds.
Common mistakes when creating comments
Common mistakes when creating comments usually come from incorrect syntax or from overusing notes in the code.
Closing the comment incorrectly
Closing the comment incorrectly can cause part of the page to stop working or disappear. Always make sure the comment has the full format <!– … –>.
Commenting out important tags carelessly can break the layout if you accidentally hide an opening or closing element. Be especially careful with containers, lists, and nested blocks.
Using too many comments
Using too many comments makes code harder to read. It is better to keep them short and relevant, leaving only the explanations that truly help.
When comments help and when they get in the way
HTML comments help when they make code easier to understand and save time during editing. They get in the way when they turn HTML into a messy collection of notes that is hard to maintain.
A good rule is simple: a comment should explain an unusual solution, an important block, or a temporary change, not repeat something obvious.
If you need to remember the syntax quickly, just keep one form in mind: <!– comment –>. That is the easiest way to leave notes in HTML without affecting how the page looks.

