Menu
HTML Fundamentals
HTML Comments
Notes ignored by the browser but visible in the source.
1Adding Comments
Comments are wrapped in <!-- ... -->. They never render but they are visible to anyone viewing source — never put secrets there.
Example Code
css
<!-- This is a single-line comment -->
<p>Visible</p>
<!--
Multi-line
comment block
-->2Put the element in context
HTML comments are absent from the visible page but remain in delivered source. They can document a section boundary or a development decision; they are not private storage. A password or internal note in a comment can still be read by anyone who receives the document.
3Practice with a small page
Add a short section comment to a page and inspect View Source. Check that the comment is not visible in the rendered paragraph. Remove any sensitive information and verify that the comment closes before the next real element.
Finished reading?
Mark this topic as complete to track progress.