Comment Tags

The <!-- --> are the tags you use to insert comments in your page coding.

Anything you put between the <!-- and --> tags in the body of your web page will be ignored by the browser.

Using Comment Tags in Your Coding

Comments and Notes

You can use the comment tags to insert comments/notes within the coding of your webpage. These comments can be notes to yourself about what the following section of coding is for E.g.

<!--Start of Navigation Bar -->
Your navigation coding
<!--End of Navigation Bar -->

Hide Code from Old Browsers

Remember this from The HTML Document Structure?

<script type="text/javascript">
<!--Your script-->

Here the comment tags are used to hide the script coding between the <!-- and --> from older browsers that do not support scripting.

Use Comment Tags to Find Problems

A traditional programmer uses the comment tags to isolate/disable sections of coding when testing and troubleshooting their coding.

You can use this method also. If there is a section of code you think is giving you problems, comment it out then view/refresh the page. If the problem goes away then the problem coding is between the comment tags. If the problem is still there, take the comment tags out and try them somewhere else and see if that section is the problem section of coding.

Notes About Comment Tags

This article is from the HTML 4.01 Basics Simplified ebook.

If you found this web page a useful resource for your own website please link as follows:

HTML Basic Tutor -

The comment tags are used to insert comments, hide scripts from browsers and for testing web page errors.