Opening Tag | Content | Closing Tag |
---|---|---|
<!-- | text | --> |
Alternate form: | ||
<! | text | > |
Comments are typically used to include information about the author, copyright restrictions, etc., into the file being browsed. Comments are also used during debugging phase of HTML page creation to temporarily disable certain parts of the page while concentrating on another part, and for "hiding" JavaScript code from the text-interpreting mechanism of the browser (see <script>).
Note: HTML comments are not nestable; that is, you cannot have comments inside comments. Thus, you cannot disable a portion of an HTML-tagged page with a comment if that portion of the page contains other comments; the first end-comment tag will terminate the current comment, no matter how many times it has been "started" (see example below).
HTML comments require a start tag and an end tag, unlike JavaScript comments (//), which extend only to the end of the current line.
Here is a fruitless attempt at a nested comment: section of an HTML-tagged page.-->
Here is a section of an HTML-tagged page.
Here is a fruitless attempt at a nested comment: section of an HTML-tagged page.>
Here is a section of an HTML-tagged page.Here is a fruitless attempt at a nested comment: section of an HTML-tagged page.-->
Here is a section of an HTML-tagged page.
Here is a fruitless attempt at a nested comment: section of an HTML-tagged page.>