All programming languages (that I've used, anyway) have a way to insert comments--text that isn't read by the interperator or compiler, used by the programmer to write notes, remind him or herself to do something, etc. HTML (which is a markup language, not a programming language, BTW) also has a way to do this for the same reasons.

Similar to how it's done in programming languages, you put whatever you don't want to be displayed in the browser inbetween this tag: <!-- -->

Example:

<HTML>
<Body>

This text is being displayed to the browser

<!-- This text isn't, because it's inside the comment tag -->

</Body>
</HTML>

Nothing inside the tag will be displayed to the screen. In some programming languages you open a comment (like // blah blah blah in Java) and not terminate it, and it will automatically terminate at the end of the line. It's not like that in HTML, the comment only terminates with the -->.

Example:

<HTML>
<Body>

This text is being displayed to the browser

<!-- This text isn't
Neither is this, even though it's on a new line. -->

</Body>
</HTML>

In the last couple of years, HTML comments became a popular way for web authors to communicate ideas discreetly to other web authors, who were the most likely folks to find these comments.

In order to stumble across these hidden remarks, the web user would have to view the source code for the web page. Aside from the naturally nosy, or those in the know about the existence of the comments, the most common reason for anyone to view the source code is to figure out how the page is designed in order to learn new web authoring techniques. Therefore, a savvy web author wishing to target a message only to other web-savvy individuals could hide extensive remarks inside HTML comments.

This technique was used most famously by the Gore Presidential campaign, which included a hidden message in the campaign web site. The message began, "Thanks for checking out our source code! ... The fact that you are peeking behind the scenes at our site means you can make an important difference to this Internet effort." From there, the message asked web designers to submit ideas for improving the campaign web site "in the spirit of the open source movement." Ironically, this clever attempt to build credibility among web professionals backfired. Gore was given some credit for the cleverness of the technique, but the internet community roundly criticized him for hypocrisy in claiming to support the open-source movement when, in fact, his entire web presence was built on closed-system technology developed by Microsoft. One Apache programmer likened the message to putting a "Buy American" bumper sticker on a Honda.

Besides the Gore campaign, other non-political web sites have found a use for hidden messages in their source code. Well-known web designer Jason Kottke runs a weblog, kottke.org, and has made a regular practice of inserting witty commentary appended to his own remarks. Some of his comments were originally meant only for his close friends, as inside jokes, but developed into an underground hit as Kottke’s cult-like following spread the word.

One of the most famous and widely imitated hidden-code tricks pulled by Kottke and a group of other web authors was to hide in their weblog entries as list of other weblogs, so that when authors of those site went ego-surfing, they would run across an entry which seemingly had no trace of the search term.

The rage seems to have subsided somewhat, but even though it’s now passé, web developers still view source code to learn new techniques, and this is one way for authors to target communication directly to that audience.

HTML comments, in addition to being useful (as iandunn points out) and an easter egg (as Mouthpiece observes) can also be downright hilarious. See, while Al Gore purported to support the open source movement through comments in his campaign's web site, some other sites aren't quite as nice. Some use right-click traps in custom browser windows to mask their source code, but those can be defeated. Earlier this year, someone posted on the newsgroup cmu.misc.market the web site of the National Academy of American Scholars, an organization whose mission statement is

To encourage a national discourse in order to raise the current educational level of pre-level college students by setting high academic standards and offering incentives to surpass these standards.
which would explain the attacks against Carnegie Mellon University, calling members of the academic community Communists as an insult, and various odd warnings on the front page. Don't attempt to duplicate the web site's look and feel. "it is recommended that both browser and Platform be 32-Bit architecture."

Just to make sure that you don't try and duplicate their web site, the following comments appear in their HTML source. (Source of http://www.naas.org)

<!--Viewing this source code is an invasion of privacy.
Please exit viewing this source code immediately. 
This code was created, edited, and authored by Team N.A.A.S.
for National Academy of American Scholars. Downloading this source code
or any source code authored by N.A.A.S. is a violation and direct
infringement of N.A.A.S. copyright privilege. 
-->
<!-- hide code from java-impaired broswers
// Create custom JavaScript 
/*Viewing or downloading this souce code represents
 an invasion of privacy and will be prosecuted as such.
All N.A.A.S. proprietary code is tracked by N.A.A.S. 'spiders'
customized 'robots'. 
==========================================================
Downloading this source code into your host system
is a severe security risk and health hazard to your computer system. 
*/
//You have been forewarned!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
(some JavaScript code for navigation)
//hide executable files*  * * * * *
// TEAM NAAS TEAM NAAS-->

Immediately after viewing this source, my computer promptly exploded. Damn you, NAAS!

Log in or register to write something here or to contact authors.