
HTML>HTML Basics>Comment Tag
The Comment Tag
The comment tag, <! -- -- --> does just what its name implies. It allows you to add comments to your HTML code. Everything inside the comment tag remains hidden and will not be displayed on the webpage.
It is always a good idea to comment your HTML code especially any complex code that you may write. This makes it easier to maintain. You may know what you were up to the day you wrote the code but if you modify code which is a year old your memory may not be as clear.
Comment tags should fall only within the <body> </body> tags.
Example
Try it out for yourself!
Examine the HTML code below. Cut and paste (Ctrl c+ Ctrl v) the following HTML code into the form window below and press the check it out button to see the resulting webpage. Notice how your comments do not appear on your webpage.
<html>
<head><title>Comment Tags</title>
</head>
<body>
<h2>The Comment Tag</h2>
<!--This is not displayed as it is a comment tag-->
This is NOT a comment so you therefore can see it on your webpage.<br> Anything within the comment tags is considered a comment and therefore the browser does not print it on your webpage.
</body>
</html>
Creating your own webpage
Follow these simple steps to create your own webpage and to view your created webpage in your browser.