<comment> HTML Tag
- 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
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:
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.
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 <!-- ... -->
.
Browser Support for comment
Not supported. | Not supported. | Not supported. | Not supported. | Not supported. | Not supported. |