HTML Comments

The comment tag is used to insert comments in the code of your document. Comment tags help us to provide description or explanation of our code, which can be helpful when we edit the source code later. In HTML, anything written between the <!-- and --> tags is taken as a comment by the Web browser. These comments are ignored by the Web browser and are not displayed on the HTML page.

For HTML Comments, tag <!-- ..comments.. --> are used to insert comments in HTML

HTML Comment Tag

Following is the syntax to add comments in your HTML documents:

<!-- Write comments here -->

HTML Comment Example

Here is an example uses comment in HTML document:

<!DOCTYPE html>
   <title>HTML Comments Example</title>

<!-- This is a comment -->
<p>HTML Comments</p> <!-- this is also a comments -->
<p>This is HTML Comments Example</p>
<!-- Comments are not displayed in the browser -->


Here is the sample output produced by the above HTML comment example code:

html comments

HTML Online Test

« Previous Tutorial Next Tutorial »

Like/Share Us on Facebook 😋