HTML Comment tag
Note: If you don't know what a tag is and/or how you must use it we recommend you to read our HTML tags and attributes tutorial that you can find in our HTML tutorials section.
The
HTML comment tag is used to insert comments inside the code. All the text inserted inside this tag (<!-- ... -->) will be ignored by the browser (with the exception of scripts and style codes in those browsers that support them) and invisible for the user. It's most common use is to "hide" scripts and style codes from older browsers (without support for it), so they don't show them as plain text.
Note that when writing
XHTML code the commented scripts and style codes are completely ignored by the browser.
This tag does not have any attribute.
There are no events defined for this tag.
See complete list and information about
events in HTML
A simple comment in the code (the comment is invisible).
Code |
View |
<p>Comment's begin</p> <!--Here is the comment text--> <p>Comment's end</p> |
Comment's begin
Comment's end |
In this case the tag is used to hide a script (in XHTML the script would be completely ignored by the browser).
Code |
View |
<script type="text/javascript"> <!-- function gimme_a() { return 'a'; } --> </script> |
|