Logo
  Saturday, April 19, 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 <ins> Tag
The HTML5 <ins> tag is not complicated to apply within a document since it supports the Global Attributes and ...
The HTML5 <rt> Tag
The HTML5 <rt> tag is used along with the <ruby> and <rp> tags to clearly define he ruby ...
The HTML5 <colgroup> Tag
The HTML5 <colgroup> tag is necessary when it comes to specifying the set of one or more columns. The column/s ...
The HTML5 <sub> Tag
The HTML5 <sub> tag is used for making sure that the character will appear half a character below the baseline.
The HTML5 <ul> Tag
The HTML5 <ul> tag is applied for an unordered or bulleted list. The use of the HTML5 <ul> tag has to be ...
The HTML5 <li> tag
The HTML5 <li> tag is utilized in different ways because this is applicable for the ordered list or <ol>, ...
More