html - html5 comments - how use comment in html

HTML Comment is not interpret by browser. HTML comment Format :-

              <!--  some line of code putting here for comment   -->

HTML comment can not Nested.

  <!-- html comment <!-- nested comment is illegal in html --> --> illegal comment in html

some html Comment Points-:

  • The tag starts with left angle bracket (<)
  • The next character is an exclamation point (!)
  • Two hyphens(--) follow the exclamation point.
  • The text of the comment is next.
  • The tag start to close with another set of two dashes(--)
  • The tag close with a standard right angle bracket(>)

how use comment in html and html5 language example

     <head> Heading  part putting here </head>
      <body><p> this is a paragraph tag</p>
      <h1>why use the html comment, how use the comment</h1>
      <p> you cannot nested the html comments. 
                  the html comment are ignored by interpreter</p>
    <!-- this part of your code is not  interpret by browser -->
      <p> this is the second para<p>
          <!--  <!--       -->      --> this is illegal comment.
          </body>      </html>

Larger Comments can make use of CDATA structures this is usefull for using the XHTML .but cdata is enabled in xml language.

the format of the CDATA tag is as follows:

<![CDATA [ commented text goes here]]>

  • The tag begins with an angle bracket(<).
  • the xmle next character is an exclamation point(!).
  • the next few characters define the xml tag([CDATA[).
  • the text of the comment is next.
  • the tag begins to close with the two brackets(]]).
  • the tag close with the right angle bracket(>)

Like the comment tag , You cannot nest <![cdata[]]> tags within each other

The text within a comment or cdatasection is still delivered to the browser and can be seen if the user chooses to reveal the source of the page. the data in these sections is just not rendered as visible text.