<comment> HTML Tag

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: