1. Home
  2. Computing & Technology
  3. Web Design / HTML

<!- - - -> Comment

By Jennifer Kyrnin, About.com

Comment Tag Description:

The <!-- --> Comment tag is used to comment XHTML code - to add information to the page that is ignored by the browser.

Comment Tag Web Browser Support:

Comment Tag Attributes:

None

Comment Tag End Tag:

<!-- --> Both tags REQUIRED

Comment Tag Contents:

Any HTML tag or element is valid within the comment tags

Comment Tag Valid Context:

The comment tags are valid within the following tags:
all HTML tags

Comment Tag Usage:

  • stand alone comment
    <!-- this text will be ignored by the browser -->
  • comment around tags
    <ul> <li>apples</li> <!-- <li>peaches</li> --> <li>oranges</li> </ul>

Comment Tag Special Notes:

  • It is not permitted to include multiple hyphens "---" in a comment.
  • Comments are best used to provide information about the page, especially when you are designing complex HTML documents.
  • While it is legal to comment HTML tags, be aware that some older browsers do not handle this functionality correctly.

More <!-- --> Comment Information:

Return to XHTML Element (HTML Tags) Library

Explore Web Design / HTML

More from About.com

  1. Home
  2. Computing & Technology
  3. Web Design / HTML
  4. HTML and XHTML
  5. XHTML
  6. HTML Tags
  7. The comment Element - XHTML 1.0 HTML 4.0

©2008 About.com, a part of The New York Times Company.

All rights reserved.