JavaScript EditorBest javascript editor debugger     Ajax website 

Main Page

Previous Page
Next Page

Adding Comments

You can add comments to your (X)HTML documents in order to remind yourself (or future editors) what you were trying to achieve with your (X)HTML tags. These comments only appear when the document is opened with a text editor. They are invisible to visitors in the browser.

To add comments to your HTML page:

In your (X)HTML document, where you wish to insert comments, type <!--.

Type the comments.

Type --> to complete the commented text.

Figure 3.23. Comments are a great way to add reminders to your text. You can also use them to keep track of revisions.

Figure 3.24. Comments are invisible (though they readily appear when the source code is displayedsee page 53).


  • Comments are particularly useful for describing why you used a particular tag and what effect you were hoping to achieve.

  • Another good use for comments is to remind yourself (or future editors) to include, remove, or update certain sections.

  • You should view your commented page with a browser before publishing to avoid sharing your (possibly) private comments with your public.

  • Beware, however, of comments that are too private. While invisible in the browser, they cheerfully reappear when the user saves the page as (X)HTML code (source). For more information on viewing a page's code, consult The Inspiration of Others on page 53.

  • Comments may not be nested within other comments.

Previous Page
Next Page

JavaScript EditorBest javascript editor debugger     Ajax website