XHTML - <!-- ... --> Comment Tag
Definition
The <!-- --> tag pair defines a comment element. Any text within the comment tags will be sent to the client browser, but will not be displayed on the page. The comment text is visible to the user if they view the source of the document.
Comments are used for a variety of purposes. It is a good practice to use comments in your XHTML code to delineate sections of code, or to place comments to make maintenance of the code easier at a later date.
Another common use of comments is to isolate code within a script such as javascript to hide it from older browsers that cannot properly evaluate the script. This is becoming less of an issue every day as older browsers fall out of use.
Example
<p>This is a paragraph before a comment</p>
<!-- This is a comment, it will not display on the page -->
<p>This is a paragraph after the comment</p>
Output
This is a paragraph before a comment
This is a paragraph after the comment
Attributes
None
Events
None
BestWebTutorials.com is a free service of CrystalClearWeb.net. You can help us keep providing free tutorials and information by:
- Link to us
- Tell a friend
- Correct any you might find
- Make for improvement
- Make a donation
BestWebTutorials.com attempts to post accurate information on this site, but we cannot guarantee that errors do not sometimes occur. The use of code examples from this site in any other site is at the user's own risk. We cannot guarantee that our code might not be in conflict with code written by others, or that our code is fit for other uses.
For further information please review our Terms of Use and Privacy Policy.
Copyright 2005-2008 CrystalClearWeb.net. All rights reserved.

