Indiana University
University Information Technology Services
  
What are archived documents?

In HTML, how do I include a comment?

To incorporate comments (i.e., text that is not to be interpreted or displayed by the web browser) into your HTML source code, use the following format:

<!-- This sentence will not be displayed by the browser. -->

In an HTML comment, everything between the <!-- and -->, including line breaks, is ignored by the web browser. Here is a sample of commented HTML code:

<!-- This list of addresses was last revised 3/5/05 --> <UL> <!-- Bob's address may change soon --> <LI><STRONG>Bob:</STRONG> 1234 Generic Drive, Erehwon, IN. <!-- This is Jane's new address --> <LI><STRONG>Jane:</STRONG> 4321 Cireneg Avenue, Nowhere, MN. <!-- Joe's not going to be moving for a long time! --> <LI><STRONG>Joe:</STRONG> C/O Inmate 123456, Eslerehwyna Federal Penitentiary, Eslerehwyna, NY. </UL>

The browser will interpret and display this as follows:

  • Bob: 1234 Generic Drive, Erehwon, IN.
  • Jane: 4321 Cireneg Avenue, Nowhere, MN.
  • Joe: C/O Inmate 123456, Eslerehwyna Federal Penitentiary, Eslerehwyna, NY.

Note: You may not use the -- construct inside an HTML comment. Also, some browsers interpret  >  within a comment as the end of the comment. Therefore, if you comment out HTML tags, some browsers may not display your page correctly.

Also see:

This is document aewt in domain all.
Last modified on September 28, 2007.
Please tell us, did you find the answer to your question?