HTML comments are notes not shown by the browser but are very useful during development. They help document the code, add explanations, or temporarily disable elements without deleting them.
A comment in HTML looks like this: <!-- This is a comment -->. It’s important that the comment is placed between <!-- and -->, otherwise it won’t be recognized.
There are many reasons to use comments during development. For example, to explain why a specific piece of code is there, or what effect an element has. They can also help other developers who later work on the same code.
If you have a temporary header used for testing, you can easily comment it out: <!-- <h1>Test Header</h1> -->. This way, it won’t be deleted but also won’t appear. This is especially useful when working on a complex page where you don’t want to risk losing content.
You can place HTML comments almost anywhere: in the <head>, at the beginning of the <body>, or directly before or after elements. Just make sure you don’t place comments inside HTML tag attributes – that’s not allowed.
Select Language
Set theme
© 2025 ReadyTools. All rights reserved.