Definition and Usage of Comments
The comment tag is used to insert a comment in the source code. A comment will be ignored by the browser. You can use comments to explain your code, which can help you when you edit the source code at a later date.
You can also store program-specific information inside comments. In this case they will not be visible for the user, but they are still available to the program. A good practice is to comment the text inside scripts and style elements to prevent older browsers, that do not support scripting or styles, from showing it as plain text.
Comments aren't displayed in the browser - they are simply there for the programmer's benefit.
A comment declaration starts with <!, followed by zero or more comments, followed by >. A comment starts and ends with “--”.
Comments can be placed anywhere within the code.
Example:
<!--This is a Comment Tag-->
<!-- And so is this one,
which occupies more than one line. -->
“White space is not permitted between the markup declaration open delimiter ("<!") and the comment open delimiter ("--"), but is permitted between the comment close delimiter ("--") and the markup declaration close delimiter (">").
Comments may not have double hyphens (--) within them. This is because technically the comment ends with --, not -->. In practice virtually all browsers don't end the comment until -->.
Comments may not have double hyphens (--) within them. This is because technically the comment ends with --, not -->. In practice virtually all browsers don't end the comment until -->.
No comments:
Post a Comment