HTML Comment

Comment is a part of the code which is not processed by the browser. An HTML comment is placed within tags. Its a good practice to add comments in the code.

HTML Comment

Comment is a part of the code which is not processed by the browser. Comments can be used for the following purposes. An HTML comment is placed within <!– and –> tags.

  • To write something about the code.
  • To prevent a part of code from being executed.
  • For debugging.

Syntax

HTML comments are specified using the following tag:

<!-- This is a comment -->

Example

<html>
<head>
    <title>HTML Comments</title>
</head>
<body>
    <!-- This is a comment -->
    <p>This is a paragraph.</p>
    <!-- <p>This will not be visible.</p> -->
</body>
</html>

Share Tweet Send
Loading...