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.
Time Required: 1 minute
- Add the first HTML comment tag:
- Write the text or information you want hidden.
- Close the comment:
- Comments can span multiple lines
- You can comment out sections of HTML by surrounding them with comment tags.
- 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.
- Comments can also include meta information such as:
- date created or modified
- copyright information
- If you're writing XHTML, you should not have two dashes together -- inside any comments.
What You Need