HTML Comments
The comments are not displayed by the browser even if they are written in the body of the HTML document. The string that is used to start the comment should not have spaces between its characters but this is not the mandatory condition for the ending comment.
Following is the example of comment:
<!- -This is a comment – ->
If this statement is written in the HTML document it will not be displayed by the browser.
Comments cannot be nested. If you want to use more comments, you should not span more than one line rather use comment strings to display the comment otherwise the comment without its string will be displayed on the browser.
Each comment is described as a text string that is surrounded by the characters string. We can also add empty comments as:
<! >
EXAMPLE:
Two or more comments can be used as follows:
<!- – This is a comment – –
– – this is the second comment that is declared with the first comment – ->
This will not be shown on the browser:
Two or more comments cannot be declared using the following format:
<! – – this is a comment
This comment is not declared properly, the browser will display it. It should be avoided.
– – >
NOTE: Do not declare comments like this otherwise the browser may mishandle these sophisticated comments. Use simple structure for comments.