HTML Comments
Table of Content:
Comment tags are used to insert comments in the HTML source code.
You can put comments between any tags in your HTML documents. Comments use the following syntax:
<!-- Write your comments here -->
Anything after will not be displayed. It can still be seen in the source code for the document, but it is not shown onscreen.
Notice that there is an exclamation point (!) in the opening tag, but not in the closing tag.
With comments you can place notifications and reminders in your HTML:
Example
comments Example Comments Example
The following word uses an emphasized typeface.
This is a paragraph.
Live Preview
You can even comment out whole sections of code. For example, in the following snippet of code you would not see the content of the <h2< element. You can also see there are comments indicating the section of the document, who added it, and when it was added.
Example
comments Example Character entities can be used to escape special characters that the browser might otherwise think have special meaning.
Live Preview
Comments are also great for debugging HTML, because you can comment out HTML lines of code, one at a time, to search for errors:
Conditional Comments
ou might stumble upon conditional comments in HTML:
Example
comments Example
Conditional comments defines some HTML tags to be executed by Internet Explorer only.