HTML Comments

A note to self

HTML Comments

You can make notes to yourself by using an HTML comment. These allow you to add information that is ignored by the browser window, and is not displayed to the people visiting your site. To write a comment you surround your text with

<!--

and

-->

. Anything between these will not be displayed. One of the most useful ways to use comments is to add a note to the end of closing <div>, <section>, or <article> tags. Sometimes when you have many of these tags it is hard to see which end tag belongs to which starting tag. Here is an example of HTML comments:

<article>
   <h2>Apples</h2>
   <p>Tasty, delicious fruit!</p>
   <p>The apple is the pomaceous fruit of the apple tree.</p>
   <section>
      <h3>Red Delicious</h3>
      <p>These bright red apples are the most common found in many
  supermarkets.</p>
  </section> <!-- end of Red Delicious section -->
  <section>
      <h3>Granny Smith</h3>
      <p>These juicy, green apples make a great filling for
  apple pies.</p>
  </section> <!-- end of Granny Smith section -->
</article>

Activity

Here you can test out what you read, and achieve badges.

Activity Instructions

Add comments after each ending </section> tag describing which beginning tag it belongs to.

(ex. <!-- end of red delicious section --> )

Notice that the comments will not show up in the output window.

HTML

CSS

JavaScript

Output