Information - Resources - Tools - Strategies

for developing a profitable Web business

Tutorials | The Comment Tag

HTML: The <!--   --> Comment Tag

The Comment Tag makes any text placed within it invisible to the Web page viewer. It is useful for placing notes and comments directly into your document's source code.

Opening tag    <!--
Closing tag   -->

Example:

<!-- This line of text will not display in a browser -->

Display:

 

The Comment tag is handy for noting personal reminders or explaining complex sections of your markup. Keep in mind that anyone viewing your markup will be able to read your comments.

Commenting Out Sections of Code

Suppose you wanted to revise or update a section of your page, you could use the Comment tag to obscure that section from browsers until you got around to it. The content would remain in the document saving you time when you return to do your edits.

You can also use this tag to isolate troublesome sections of your code while you troubleshoot the problems and make the necessary corrections.

It is also common practice to use the Comment Tag to hide JavaScript that is embedded in your HTML doucments. This is to prevent older browsers that are unable to read JavaScript from displaying it by mistake.


« Previous  ¦  Next »




 

Newsletter

Name:

Email:

Useful Stuff
Ponder This

Very often opportunity is disguised as misfortune. Don't be fooled.