Comment Tags

Comments are extremely useful in HTML, especially for long, complicated documents. Comments enable you to make notes, find certain spots quickly, place notifications or reminders to yourself, all within your HTML document. Browsers do not display comments at all. Note that there is an exclamation mark (!) in the opening tag, but none in the closing tag. To add a comment to your HTML document, use the following syntax:

<!-- comment -->
HTML file: Displayed by browser:
<!-- This is a comment element, complete with an end tag -->

<p>This first paragraph, which is between two comments and will be displayed by the browser.</p>

<!-- This is another comment element, also complete with an end tag -->

<!-- This is an opening comment tag, without the end tag

<p>This second paragraph, is between an opening comment tag and the closing comment tag, so it will not be displayed.</p>

This is the comment closing end tag -->

<p>This third paragraph is outside any comment tags and will be displayed.</p>

This first paragraph, which is between two comments and will be displayed by the browser.

This third paragraph is outside any comment tags and will be displayed.


Back buttonTable of ContentsNext button