Saturday , February 23 2019

HTML Comment Tag with Example

HTML Comment Tag is used to add comments within HTML document source code to hide informative text which can help you while using different codes or JavaScript code from the browser.  HTML comments are placed between <!– ……. –> tag.

Read: what is HTML (Hypertext Markup Language)?

Read: List of Complete HTML Tags


Example of HTML Comments Tag:

<!DOCTYPE html>



<!– This is a head section –>

<title> Title text goes here… </title>



<!– This is a body section –>

<p> body text goes here…</p>




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

Example of HTML Comment Tag to hide the JavaScript Code:

<script type=”text/javascript”>


JavaScript code here




Browsers Support Comment Tag

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

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.