The HTML comment tag is used to insert comments inside the document's code. These comments are not rendered by browsers, and therefore aren't visible for the end user. The main purpose of this feature is to let authors add explanations, reminders and other resources to help themselves and others in the process of editing the document. It's also commonly used to exclude some parts of the document from the rendering process during testing.
A comment consists of the following parts:
- The string "<!--", or comment start delimiter.
- A run of text representing the actual comment, respecting the following restrictions:
- must not start with a ">" character
- must not start with the string "->"
- must not contain the string "<!--"
- must not contain the string "-->"
- must not contain the string "--!>"
- must not end with the string "<!-"
- The string "-->", or comment end delimiter.
In the following example there's a simple comment in the code, the author inserted as a remainder. The comment is invisible when the document is rendered by the browser.
<p>This specification has been divided in three parts...</p> <!-- Guys, here we should add a better description about the distribution of content in the spec... --> <p>In the first section, you'll find...</p>
This specification has been divided in three parts...
In the first section, you'll find...
Now, a part of the document is being removed for being under consideration. This practice is useful in some situations, because the commented content isn't rendered in the document but it isn't deleted either; it's just a piece of content that's been excluded (or unpublished) from the document.
<p>The modification process is rather simple...</p> <!-- <p>To modify the configuration you should:</p> <ol> <li>Locate and open the configuration file in your favorite text editor.</li> <li>Find the parameter you want to modify and replace the value on the right by the new value.</li> </ol> -->
The modification process is rather simple...