29/09/2014

HTML Comments

Comments are often used in the HTML codes. That is why it is important not to be pointed out to the browser to avoid showing them. There are many reasons we can add a comment within a html script. A note or a reminder, a specification, a blank title or a clarification.
Javascript comments
An unfinished element The comment will be placed between the "<!--" and "-->" tags. This way, we will be able to leave a note to remember on a later time what the code was for, or if something is still needed to be introduced in there.
<!--The beginning of the code that shows a photo-->
<img src="hoto.jpg" alt="blank" width="52" height="52" /></a>
<!--The end of the code that shows a photo-->
Preview
blank
This is just an example of the things you can comment in a script. In time, you will learn that these comments are very useful for a better understanding of the code at a later date. Any text, characters, symbols or anything else placed between the opening tag "<!--" and the ending tag "-->"
HTML Unfinished script
Comments are very useful when you work at a script but you leave it unfinished. Putting it between the two tags "<!-- code --> will be interpreted as a comment by the browser and therefore will not be shown. When you have finished the code and you will need to show it all you will need to do is to erase the two tags and the browser will show the wanted script.
Input
<input type="text" size="12" />
Output