Thursday, March 12, 2009

HTML Comments Tag

The information on this page is based on HTML version 4.01 (which is the current version of HTML). The next version, HTML 5, is currently being written. Here's a list of HTML 5 tags.

The HTML 'comments' tag is used for creating comments within your HTML code.

Comments aren't displayed in the browser - they are simply there for the programmer's benefit. Comments can assist you, the HTML programmer, because you can write notes to yourself that explain what the code does. This is especially useful when you have a lot of code.

HTML comments are often used in conjunction with JavaScript. Programmers surround their JavaScript code with HTML comments. The HTML comments tell browsers that don't support JavaScript (or with JavaScript disabled) to ignore the code in between. This prevents the code from being displayed to your users.

You can see an example here.

Example
Attributes: None.
Try it yourself!

No comments:

Post a Comment