HTML Comment Tag

It is very easy to add HTML comment tag within the HTML documents source code. It is used to hide some informative text while explaining different codes or JavaScript code from the browser. It’s like a label which has a beginning and an end tag. All the text that you put inside the comment tag will not appear on the display webpage.

The comment starts with <!– and ends with–> Everything you put between these labels is commented.

Read also: HTML Tags complete list

Syntax:

Example of HTML Comments Tag:

Example of HTML Comment Tag to hide the JavaScript Code:

The two forwarded slashes (//) must be put just after the JavaScript code. It prevents the JavaScript code from execution.

Browsers Support HTML Comment Tag

  • Inter Explorer (all)
  • Google Chrome (all)
  • Firefox (all)
  • Safari (all)
  • Opera (all)