HTML 5 Programming and Web development/HTML 5 Comments

From Wikibooks, open books for an open world
Jump to navigation Jump to search

A comment in HTML is an area of text that is ignored by the browser. In an HTML comment, you can write anything. These are some examples of comment.

<!-- This is a comment -->
<!-- I love HTML -->
<!-- London bridge is burning down -->

Comments written in angle brackets with an exclamation mark at the start followed by two hyphens (minus sign) and ending with two hyphens.

Reasons for comments[edit | edit source]

Comments in HTML are conventionally used as:

  • A directive to show viewers of the source code what it does
  • To insert information about the document that viewers of the source code should know such as license and author's information