HTML comments <!-- -->
- closing tag
- n/a — self-contained syntax
- void element
- n/a
- lives inside
- anywhere
- typically holds
- notes for humans
Where it goes
Anywhere, to explain something the code does not make obvious.
Example
<!-- TODO: replace this placeholder image -->Open this example in the editor →
Common mistakes
- Putting private information in a comment. Anyone can see it by viewing the page source.
- Writing two hyphens in a row inside the comment. A -- can end the comment early in some browsers.
- Leaving big blocks of old code commented out. It still downloads with the page and confuses the next reader. Delete it.