Deprecated in HTML5. Do not use.

<comment> HTML Tag

Disclosure: Your support helps keep the site running! We earn a referral fee for some of the services we recommend on this page. Learn more
What does <comment> HTML Tag do?
The <comment> element was an experimental way of adding comments to HTML code that would not be rendered by the browser. It was never added to the HTML specification and is not supported by modern browsers.
Display
none
Usage
textual
The Comment Element is Obsolete This element is obsolete and should not be used. Browser support for this element is limited and using it may produce unexpected results. Instead, use the modern comment tag.

How not to Make a Private Comment in HTML

<comment> is an old Mosaic and Microsoft Internet Explorer tag. It’s a nice tag, but it was implemented in a weird way and never really caught on. Don’t use it. <comment> causes the browser to ignore everything between <comment> and </comment>. Unfortunately, because some browsers do not recognize the tag, most people will see those embarrassing comments. For example, let’s say that you add a comment like this to your code:

<comment>Plans for improving this page:     - stop writing pages in the nude    - learn to spell</comment> 

Some browsers will ignore the <comment> tags and just display this:

Plans for improving this page: – stop writing pages in the nude – learn to spell

Browsers that do ignore <comment> tags will still render any html code nested between the tags. For example:

<comment>Plans for improving this page:     - <strong>GOT</strong> to stop writing pages in the nude    - learn to spell</comment> 

While the <comment> tags may be ignored, the <strong> tags will be picked up just fine.

Plans for improving this page: – GOT to stop writing pages in the nude – learn to spell

No word yet on whether this is considered a bug or a feature. Our advice? Here it is:

Use the correct comment tag

The correct comment tag for HTML is <!-- ... -->.

Adam is a technical writer who specializes in developer documentation and tutorials.

Browser Support for comment

iefirefoxchromeedgesafariopera
Not supported.Not supported.Not supported.Not supported.Not supported.Not supported.