Maddog's HTML for Real People Chapter 2, Lesson 10


[INDEX] Ch 2, L 10 - Embedding Comments in the Source File

If you already know how to place HTML comments in your source file, you can skip this lesson.

Being able to embed comments in your source file is important. Comments are text that the author can read in the editor, but the browser ignores when it's building a web page. Often, you, the web page author, want to remind yourself of something clever you're doing, so that two months from now you won't be cussing yourself out while you try to figure out why the heck you did somthing so strange.

The HTML standalone tag for a comment is <!-- (comment goes here) -->. Everything between the "<!--;" and the "-->" constitutes the "comment".

Often, HTML comment tags are used to hide a version number or an instruction to the ISP's HTTP server (never the browser). We won't cover the use of comments for that purpose, because it's fairly advanced, and requires coordination with the HTTP server. But if you encounter a web page which uses "scripts" to accomplish something really slick, in all likelihood they have used the HTML "comment" tag to pass information to the HTTP server.

Let's see how we might use the comment tag in our source code:

HTML Source Code Follows:


<!-- The last sentence in this paragraph contains the punch line -->

The quick brown fox jumps over the lazy dog.  
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox is getting on my nerves.
(End of HTML Source Code)

Demonstration Follows:

The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox is getting on my nerves.

(Demonstartion Ends)

Notice that the comment simply doesn't show up on the browser screen, but we can see it just fine in the source code.


-PREVIOUS- -CHAPTER- -INDEX- -NEXT-

Overseer: Monty Northrup ... maddog@io.com ... leave e-mail ...
...to maddog 'n' miracles homepage...