Introduction to HTML : Comments


Comments in any programming language is a way to add notes inside a piece of code to indicate how the code works. Comments may also be used to explain concepts and reasons for making certain decisions within the code to other developers who may have access to the code. 

The browser ignores HTML comments and therefore are not shown to the user. 

Texts inside a <!-- --> are interpreted as comments. Example:

<p>Normal paragraph</p>
<!-- I am a comment -->

This will output:

Normal paragraph


Comments may span a single line or multiple lines (multi-line comments)

Examples of multi-line comments:

       This is a multi-line comment.
       This is the second line.
    <p>I am outside of the comment</p>

This will output:

I am outside of the comment

course logo
Introduction to HTML
Number of sections:
Content length:
Delivery formats: