HTML - <comment> and <!--....--> Tag


Advertisements


Description

The HTML <comment> tag allows authors to comment their HTML code. This tag is supported by IE only.

It is recommended to use <!--....--> to comment your tags. This tag is compatible to all browsers.

Note − The <comment> tag deprecated in HTML5. Do not use this element.

Example

Live Demo
<!DOCTYPE html>
<html>

   <head>
      <title>HTML <!--....--> Tag</title>
   </head>

   <body>
      <comment>This is a commented line in IE</comment>
      
      <!-- This is a commented line supported by almost every browser.
         It will not appear in output as its a comment. 
      -->
   </body>

</html>

This will produce the following result −

Browser Support

Browser Support for <comment> tag

Chrome Firefox IE Opera Safari Android
Not Supported Not Supported Yes Not Supported Not Supported Not Supported

Browser Support for <!--...--> tag

Chrome Firefox IE Opera Safari Android
Yes Yes Yes Yes Yes Yes

html_tags_reference.htm

Advertisements