Tuesday, July 22, 2014
Sign-In  |  Sign-Up  |  Contact Us  | Bookmark |  RSS Feed

HTML5 Tutorial FeedBurner

The HTML5 <!--…--> Comment Tag  
The HTML5 <!--…--> tag is mainly utilized for adding comment in the source code. However, do not expect the comment to appear on the web browser. Utilizing the HTML5 <!--…--> tag is important for adding comments which will serve as notes regarding your code. That way, if alterations have to be done in the future, it is useful as a reference. When there are multiple source codes, this tag will avoid confusion.

Another way to use the HTML5 <!--…--> tag is to be able to hide the scripts in browsers that do recognize it. It is a tag that would avoid showing the script as a plain text.

When used for scripts, it is necessary to add // at the end of the comment. The // is a comment symbol in JavaScript. It would look like this:

<script type="text/javascript">


function displayMsg()


alert("Comment should be placed here!")




Adding the // is necessary so that JavaScript would not interpret it as the --> tag.

The HTML5 <!--…--> tag is compatible with the different main browsers that are being utilized these days like Internet Explore, Firefox, Opera, Safari and Google Chrome.

Using the <!--…--> tag is the same for both HTML5 and HTML4.01. This tag does not support the Global Attributes and Event Attributes.

Print HTML5 <!--…--> Comment Tag Bookmark HTML5 <!--…--> Comment Tag

Related Articles  
The HTML <noframes> Tag
The HTML <noframes> tag is no longer accepted and used in HTML5. In the previous HTML, particularly HTML4.01, ...
The HTML5 <figure> Tag
The HTML5 <figure> tag is primarily used for adding self-contained content within the document. It is utilized ...
The HTML5 <kbd> Tag
When creating an HTML document, the purpose of HTML5 <kbd> tag is to specify a keyboard input. It is for the text ...
The HTML5 <small> Tag
If there are smaller texts and side comments that have to be placed in the HTML document, the HTML5 <small> tag ...
The HTML5 <dfn> Tag
The HTML5 <dfn> tag is useful when it is necessary for the author to provide a definition of a term.
The HTML5 <area> Tag
The HTML5 <area> tag is used for adding details to specific areas within an image map. An image map is an image ...