HTML comment tag <!–…–> HTML comment tag is used to give comments in the source code. Generally, comments are used when you have a long piece of code. Comments are not displayed in the browsers.
HTML Comment Tag <!–…–>
This helps in editing the code when required. You can use comments to explain your code, which can help you when you edit the source code at a later date. This is especially useful if you have a lot of code.
Syntax: <!–This is a comment.–>
Browser compatibility
The HTML Comment tag is supported by a different type of browsers.
- Chrome
- Opera
- Safari
- Firefox
- InternalExplorer.
Example:
<!DOCTYPE html> <html> <body> <!-- This is a comment --> <p>This is freshersnow tutorial</p> </body> </html>
Output:
This is a freshersnow tutorial
Standard and event attributes
Standard and event attributes are not supported by comment tag.