HTML <!-- ... --> tag

The <!-- ... --> tag is used to insert comments in an HTML code. Browsers ignore its content and do not display it. However, the comments are visible to anyone who views the page source code.

The HTML comments are used to indicate sections of a document or insert any notes explaining the code. The comment tag can also be used to exclude temporary code blocks instead of deleting them.

Comments can be used anywhere in the documents except for the <title> tag.

Syntax

Comments are written between <! and --> symbols.

Example

<!DOCTYPE html>
<html>
  <head>
    <title>Example of using the comment tag.</title>
  </head>
  <body>
    The content of the page. 
    <!-- This is our comment, that is not displayed on the browser. --> 
  </body>
</html>

Result

The comment tag doesn’t support the Global Attributes.

Browser support





Related articles