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 ?
- CSS | Comments
- SASS | Comments
- How to block comments in YAML ?
- Inline HTML Helper - HTML Helpers in ASP.NET MVC
- HTML Course | Structure of an HTML Document
- HTML | <html> xmlns Attribute
- HTML | DOM HTML Object
- HTML Course | Basics of HTML
- What is the difference between <html lang="en'> and <html lang="en-US'> ?
- HTML | b Tag
- HTML | bdo Tag
- HTML | <pre> Tag
- HTML | <tt> Tag
- HTML | <u> Tag
- HTML | <big> Tag
- HTML | <dir> Tag
- HTML vs XML
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