HTML Comment <!–– ––>

The HTML comment tag is a great feature of HTML.

The HTML comment tag allows you to place comments in your code that are NOT visible to users.

This is helpful to leave yourself notes as to why you did something or what the purpose of something is.

If you do a right-lick and view source of a web page, comments will usually be in green color and in italics.

It’s especially useful for large/long projects as it allows you to leave reminders or little notes as you go which you can refer back to.

To use code comment surround your text with the comment opening and closing tags such as, .

You can write your comment between these tags. Simple!

Here is a simple yet straight-forward example of using comment tag:

Comments really come handy when return to your code after several days, months or even years and want to continue to edit your design.

Usage

The comment tag can be used anywhere in the webpage, in the or

Code:


<!DOCTYPE html>

<html>

<head>

<!-- This is the stylesheet John created in 2020 -->

<link rel="stylesheet" href="/file/stylesheet.css">


</head>

<body>

Content of the page goes here.

</body>

</html>