HTML <!-- --> (Comment) Tag

Description

The comment tag is used to insert a comment in the source code. A comment will be ignored by the browser. You can use comments to explain your code, which can help you when you edit the source code at a later date.
You can also store program-specific information inside comments. In this case they will not be visible for the user, but they are still available to the program. A good practice is to comment the text inside scripts and style elements to prevent older browsers, that do not support scripting or styles, from showing it as plain text.

Properties

Permitted Parents
-
Content
-
Start/End Tags
Start tag: required, End tag: required

Example

<!--This is a comment, it will not be displayed in the browser--><p>But this will</p>

Attributes

None

Global Attributes

None

Event Attributes

None

Browser Support

The following table will show you the current browser support for the HTML <!-- --> (Comment) tag.

Desktop
Edge Chrome Firefox Opera Safari
1211151
Tablets / Mobile
Chrome Firefox Opera Safari Samsung Webview
18414114.4

Last updated by CSSPortal on: 30th September 2023