HTML Introduction | HTML Text Elements | Comments

Comments

A comment is a statement written by a developer to help understand the relevant code or for debugging. Unlike other HTML code, comments are not displayed by the web browser.

The way to write a comment in HTML is as follows.

Example

<!-- comment content -->

The opening tag of an HTML comment, <!--, contains an exclamation mark, !, but the closing tag, -->, does not. These comments can be used anywhere in HTML code. Comments written across multiple lines are also recognized.

Example

<!--
Comments can be used anywhere in HTML code.
Comments written across multiple lines are also recognized.
-->