Logo
  Wednesday, July 30, 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!")

}

//-->

</script>

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 HTML5 <u> Tag
The HTML5 <u> tag is no longer functional in HTML5. Before, the purpose of using HTML <u> tag is to put an ...
The HTML5 <q> Tag
The HTML5 <q> tag is placed within an HTML document if there is a need to add a short quotation in the document. ...
The HTML5 <hgroup> Tag
The HTML5 <hgroup> tag is mainly used as a representation for the heading of a section. The HTML5 <hgroup> ...
The HTML5 <dt> Tag
The HTML5 <dt> tag is an important addition in any HTML document particularly when further terminology definition ...
The HTML5 <label> Tag
The main purpose of the HTML5 <label> tag is to provide a name for the <input> element. It is not something ...
The HTML5 <ol> Tag
The formal definition of the HTML5 <ol> tag is that it specifies an ordered list. This works with <li> tag ...
More