| Depr. | Empty | Version |
|---|---|---|
| Yes | No | N/A |
| IE5.5+ | FF2 | SA4 | OP10 | CH2 |
|---|---|---|---|---|
| Full | None | None | None | None |
Syntax
<comment data="URI">
</comment>
Description
The comment
element is a non-standard and little-supported element that’s used to add
comments to markup. It has just one
attribute—data—that points to a web page that
provides further information about the comment. Moving forward, this
element shouldn’t be used. Instead, use the standard HTML comment syntax
of <!-- comment here -->.
Example
Here’s an example of how
comment might be used:
<p><strike>The guy is a fool.</strike><comment>I obviously misunderstood what he was saying at first!</comment> The guy is an absolute genius. What was I thinking?</p>
Use This for…
This element can be applied to any text content.
Compatibility
| Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 5.5 | 6.0 | 7.0 | 8.0 | 1.0 | 1.5 | 2.0 | 1.3 | 2.0 | 3.1 | 4.0 | 9.2 | 9.5 | 10.0 | 2.0 |
| Full | Full | Full | Full | None | None | None | None | None | None | None | None | None | None | None |
All the browsers tested apart from Internet Explorer ignored the comment element in the example HTML above; they rendered the text it contained as shown in Figure 1.
Figure 1. A browser’s interpretation of the
comment
element
Instead of comment, you should use this
approach to create code comments:
<p><strike>The guy is a fool.</strike><!-- I obviously misunderstood what he was saying at first! --> The guy is an absolute genius. What was I thinking?</p>
User-contributed notes
There are no comments yet.