News:

This week IPhone 15 Pro winner is karn
You can be too a winner! Become the top poster of the week and win valuable prizes.  More details are You are not allowed to view links. Register or Login 

Main Menu

HTML primer - HTML Comment Tags

Started by ben2ong2, October 03, 2006, 05:46:01 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

ben2ong2

As your HTML pages grow, so will their complexity. Maintaining such complex pages can be quite a problem if there is no way to add documentation to these files. Fortunately, HTML provides tags through which you can add comments to various sections of your scripts. Take my advice, use the comments tags generously in your documents. When you look back at your files after a few months you shall be able to decipher the code much faster.

The starting comment tag is <!-- (that's the 'lesser than' sign followed by an exclamation mark and two dashes) and the ending tag is -->.

The browser does not display any text placed between these tags. Try this out yourself. Open a new document in Notepad and type the following and check the results in a browser.

<HTML>
<HEAD>
<TITLE>Testing Comment tags in HTMLs</TITLE>
</HEAD>
<BODY>
I am visible.
<!-- I am not displayed by the browser -->
</BODY>
</HTML>
Your comments can span multiple lines as in:

<!--
This comment
spans multiple lines
making the code easy to read
after a few months.
-->
Comment tags are invaluable if you work (or are planning to work) in a group. Your colleagues will be able to understand and decipher your code faster if you have used comment tags judiciously.


You are not allowed to view links. Register or Login
You are not allowed to view links. Register or Login