How To, HTML/CSS

How to use comments in HTML With Example

In this article, How to use comments in HTML we discussed How to comment out in HTML?, HTML comment syntax, and two...

Written by Bikash · 1 min read >

In this article, How to use comments in HTML we discussed How to comment out in HTML?, HTML comment syntax, and two or more examples where we use HTML comments in the document.

Basically, comments are helpful for web developers or designers to know about source code working which is encapsulated with some information about code using Comment Tag by any developer.

how to comment in html
HTML: How to Comment

Here are the details which we discuss in this article,

  • Major points about HTML Comment Tag
  • HTML: How to Comment with Example
  • Browser Support

Major points about HTML Comment Tag

  1. The <!--...--> is an HTML Comment Tag.
  2. When you place content or information between <!--...--> this tag browser would not show these pieces of information.
  3. Developers can also hide the script tag code using HTML comments.
  4. Comment out HTML allows developers to leave notes or information about source code.

Also Read: How to Include Comments in CSS

HTML: How to Comment with Example

The HTML comment encapsulates the piece of information by using a comment tag.

Syntax

Single Line Comment

Multiline Comment

Sometimes we need to comment out multiple lines or some lines of code, then we use multiline comments.

You can also comment out or hide script code which is defined inside <script> the tag.

OR

Note: You may also see <comment> tag somewhere but that comment tag is not supported by modern browsers.

Supported Browsers

Chrome (1+)

Edge (All)

Firefox (1+)

IE (All)

Opera (All)

Safari (All)

Here is the complete explanation HTML Comment.

Also, Read

Happy Coding..!

Was this article helpful?
YesNo
Written by Bikash
My name is Bikash Kr. Panda. I own and operate PHPCODER.TECH. I am a web Programmer by profession and working on more than 50 projects to date. Currently I am working on the web-based project and all the CMS and frameworks which are based on PHP. Profile

Leave a Reply

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