Previous Next

HTML Comments

HTML comments are pieces of text wrapped in < !--- and -- > on an HTML document. They serve many different purposes, such as providing explanations, reminders, and comments to the developers handling the code.

Types of Comments

There are two types of comments in HTML:

Single-line Comments

Single-line comments in HTML begin with < !-- and terminate with -- >. Anything between these is interpreted as a comment and is not displayed in the web browser.

Example:

< ! -- This is a single-line comment -->

Output

Multi-line Comments

Multi-line comments run over several lines and are ideal for giving elaborate explanations.

Example:

< ! --
This is a multi-line
comment. -- >
Previous Next