<!–…–> tag – Comment tag

<!--...--> HTML Comments tag

Earlier, the <comment> tag was used for comments.

But, the <comment> tag  is deprecated in HTML5.

So, you should code the comments like below – 

<!--I am a comment-->

Why comments are used and how to see it?

  • To explain code to other designers/developers.  They can refer it during editing/modified the code.
  • Sometimes, you do not want to delete the code but do not want to execute this, then you can comment that code.
  • Comments are invisible to end users but the other developers can see the source code to check for any comments.
  • The search browser inspector can be used to see the comments. 

Example

<body>
 <!-- Learn HTML from scratch -->
 <p>Example for comment tag</p>
 <!-- Comments are invisible to end users. -->
</body>

How Browser will display

Difference between HTML4.01, XHTML and HTML5

HTML4 XHTML HTML5
None None None

Attributes used with comment tag

NONE

Global Attributes

The comment tag does not support Global attributes.

Event Attributes

The comment tag does not support Event attributes.

Supporting Browsers

supporting-browsers for tags

Tutorials for all brains!