The comment tag (<!– Comment –>) is used to insert comments in the HTML code. It is a good practice of coding so that coder and the reader can get help to understand the code. It is helpful to understand the complex code. The comment tag is useful during the debugging of codes.
- It is simple piece of code which is wiped off (ignore) by web browsers i.e, not displayed by browser.
- It helps the coder and reader to understand the piece of code used for specially in complex source code.
<!-- Comments here -->
Types of HTML Comments: There are three types of comments in HTML which are:
- Single-line comment
- Multi-lines comment
- Using <comment> tag
Here you can see the single-line comment.
Multi-line comment: Multiple lines can be comment using (<!– –>) tag.
Here we can see that in the comment section we have used multiple lines but still it’s not printed.
Using <comment> tag: There are few browsers that support <comment> tag, Internet Explorer is one of them.
If we use Internet Explorer, then it will show the following result:
This is Internet Explorer.
But when we don’t use Internet Explorer, then it will show the following result:
This is not Internet Explorer
Supported Browser: The browsers supported by <!– –> tag are listed below:
- Google Chrome
- Internet Explorer
- How to write comments in HTML ?
- SASS | Comments
- CSS | Comments
- How to block comments in YAML ?
- HTML | <html> Tag
- HTML Course | Structure of an HTML Document
- HTML Course | Basics of HTML
- HTML | DOM HTML Object
- HTML | <html> xmlns Attribute
- What is the difference between <html lang="en'> and <html lang="en-US'> ?
- Inline HTML Helper - HTML Helpers in ASP.NET MVC
- HTML | scoped Attribute
- HTML | DOM lang Property
- HTML | <section> Tag
- HTML | DOM Style backgroundClip Property
- HTML | DOM Style borderTop Property
- HTML | <th> valign Attribute
- HTML | <col> align Attribute
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : nidhi_biet