HTML Comments
HTML Comments
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++
HTML Comments
❮ Previous Next ❯
HTML comments are not displayed in the browser, but they can help document your HTML
source code.
Notice that there is an exclamation point (!) in the start tag, but not in the end tag.
Note: Comments are not displayed by the browser, but they can help document your HTML
source code.
Add Comments
With comments you can place notifications and reminders in your HTML code:
Example
<!-- This is a comment -->
Tutorials Exercises Services Sign Up Log in
<p>This is a paragraph.</p>
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++
Try it Yourself »
Hide Content
Comments can be used to hide content.
Example
<p>This is a paragraph.</p>
Try it Yourself »
You can also hide more than one line. Everything between the <!-- and the --> will be hidden
from the display.
Example
Hide a section of HTML code:
<p>This is a paragraph.</p>
<!--
<p>Look at this cool image:</p>
<img border="0" src="pic_trulli.jpg" alt="Trulli">
-->
<p>This is a paragraph too.</p>
Try it Yourself »
Tutorials Exercises Services Sign Up Log in
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++
Comments are also great for debugging HTML, because you can comment out HTML lines of
code, one at a time, to search for errors.
Example
Hide a part of a paragraph:
Try it Yourself »
?
Exercise
What is the correct syntax for adding a comment in HTML?
Submit Answer »
Tutorials Video:
Exercises HTML
Services Comments
Sign Up Log in
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++
❮ Previous Next ❯
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++
COLOR PICKER
PLUS SPACES
Top Tutorials
HTML Tutorial
CSS Tutorial
JavaScript Tutorial
How To Tutorial
SQL Tutorial
Tutorials Python
Exercises
Tutorial
W3.CSS Tutorial
Services Sign Up Log in
HTML
CSS Bootstrap Tutorial
JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++
PHP Tutorial
Java Tutorial
C++ Tutorial
jQuery Tutorial
Top References
HTML Reference
CSS Reference
JavaScript Reference
SQL Reference
Python Reference
W3.CSS Reference
Bootstrap Reference
PHP Reference
HTML Colors
Java Reference
Angular Reference
jQuery Reference
Copyright 1999-2025 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.