Javatpoint Logo
Javatpoint Logo

HTML Comments

Comments are some text or code written in your code to give an explanation about the code, and not visible to the user. Comments which are used for HTML file are known as HTML comments. Anything written between these tags will be ignored by the browser, so comments will not be visible on the webpage.

Comments of any code make code easy to understand and increase readability of code.

Comments are also part of the code, which gives an explanation of the code.

How to add comment In HTML

You can add comments in your HTML file using <! -- ... --> tag. So if you will write anything between theses comment tag that will be treated as comment and browser will not read it.

Syntax

Note: The commented code will not be visible to a webpage, and hence you can use comment tag for documentation purpose, and debugging purpose:

Such as:

Example:

Test it Now

Multiline Comment

In HTML code, we can also comments multiple lines at a time. In multiline comment we can use any description about code or multiple line code to debug, etc.

Syntax

Example:

Test it Now

Output:

HTML Comments

Supporting Browsers

Elementchrome browser Chromeie browser IEfirefox browser Firefoxopera browser Operasafari browser Safari
<!-- -->YesYesYesYesYes
Next TopicHTML File Paths





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA