HTML COMMENTS

Html comments is a simple piece of code that is ignored by web browsers i.e, not displayed by the browser.It helps the coder and the reader  to understand the complex code.It is a good practice of coding.The comment tag (<!– Comment –>) is used to insert comments in the HTML code.

Types of HTML Comments: There are three types of comments in HTML : 

  • Single-line comment
  • Multi-lines comment
  • Using <comment> tag

Single-line comment:

Single line comment using(<!– –>)

<!DOCTYPE html>
<html>
 
<body>
    <!–This is heading Tag –>
    <h1>Heading</h1>
   
    <!–This is single line comment –>
    <h2>This is single line comment</h2>
</body>
 
</html>

Multi-line comment

Multi-line comment using(<!– –>)

<!DOCTYPE html>
<html>
  <body>
    <!– This is
         heading tag –>
    <h1>Heading</h1>
 
    <!– This is
         multi-line
         comment –>
    <h2>This is multi-line comment</h2>
  </body>
</html>

Using < comment> tag:

it is not supported by any modern browser.

 

<!DOCTYPE html>
<html>
 
<body>
    <comment>This is heading tag</comment>
    <h1>Headi ng</h1>
   
    <comment>This is multi-line
             comment
    </comment>
</body>
 
</html>

DOWNLOAD LATEST PROJECTS