HTML Cookbook Basic HTML Course

It's Easy!

Alternate version

The Comment Tag

Every computer language has a way of adding comments. Good coders use them liberally.

Use comments to make notes for yourself or for others that may use or view your code.

Comments in a computer program are not executed as part of the program. In HTML, they are not seen on your page.

You can use comments to:


HTML Comment Tag Form: <!-- ... -->

The HTML Comment tag is a container.
It has a start tag ( <!-- ) and an end tag ( --> ).

Your comments go between the 2 tags.

If you only have a few words, you can put the whole thing on one line:

<!-- a few words -->

If you want to comment a few lines or want to leave space to add a section later, you can put the start tag on a line, then your comments, then the end tag on a line.

<!--
put guestbook code here
-->


<!--
blah blah blah blah 
more blah blah blah 
still more blah blah 
-->


<!--
add pictures of Fluffy
add email link
sign up for a counter and add counter code
-->

Real life examples from my pages

Sometimes I leave notes for visitors that might source my pages.


<!--
Hey, how ya' doin'? 
Thanks for visiting my page.
Have a super day!

Gnubee
-->

I have some large MIDI pages with lots of links. I want the links alphabetized. When I add a new song, I want to find the right section of the alphabet quickly.

I use triple letters of the alphabet in comments for easy navigating in my pages. To get to a section of the alphabet, I hit my find key, enter a letter 3 times and I go instantly to the right section.

It looks a bit like this:


<!-- aaa -->
link
link
link
<!-- bbb -->
link
link
link
<!-- ccc -->
link
link
link
etc.

I'm sure you can think of some useful ways to use the comment tag on your pages.

Happy coding!
Gnubee

Links
Tips
Tools
References
Rules
HTML Help Gnubee - Newsgroup
HTML Course Contents (Home)

Valid XHTML 1.0!

Valid CSS!