Although the first HTML pages you write will be fairly simple, they can get complicated in a hurry. As your pages become more detailed and complex, you might find it difficult to remember what a particular section of code is supposed to do. The easiest solution is to add comments to your HTML source code. Comments function as little notes to yourself (see Figure 1-4). Web browsers will ignore the comments completely, but they will come in very handy if you are writing a complex page with many lines of HTML.
Figure 1-4: HTML code with a comment added.
Adding comments to your HTML is easy. Just enclose your comment between comment tags: <!-- Add your comment here -->.
To add a comment to the Web page you just created, follow these steps:
Open index.htm in Notepad.
Anywhere between the <body> </body> tags, type the first comment tag: <!-- (a “less than” sign, followed by an exclamation point and two dashes).
Type This is a comment.
Type the closing comment tag: --> (two dashes followed by a “greater than” sign).
Your completed comment should look like this:
<!-- This is a comment -->
If you save and display the page in a browser, and you have entered the comment tags correctly, the comment should not display. If you see it, check your comment tags to make sure you wrote them correctly.