Tips for Using HTML Comment Tags

HTML code
zokara / Getty Images

HTML comment tags are an important part of HTML because they allow you to put notes to yourself and even hide HTML code so the browser doesn't display it.

Difficulty: Easy

Time Required: 1 minute

Here's How:

  1. Add the first HTML comment tag:


  1. Comments can span multiple lines
  2. You can comment out sections of HTML by surrounding them with comment tags.
  3. Use comments whenever you write any complicated code that might be hard to figure out later. A good best practice is to put comments at the beginning and end of layout tags so you know where your page structure is.
  4. Comments can also include meta information such as:
    • author
    • date created or modified
    • copyright information
  5. If you're writing XHTML, you should not have two dashes together -- inside any comments.

What You Need: