Arrow

HTML Comments

AuthorHariom Prajapati

Pubish Date23 Jul 2022

categoryHTML 5

HTML comments are not visible on browser but it help developers to know about code.

HTML Comment Tag

HTML comment start with ' <!--  ' and end with ' --> '

Syntax -

<!-- Write your comments here -->

For example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Html comment tag</title>
</head>
<body>
    <!-- This is a comment -->
<p>Welcome to teknowize.com</p>
<!-- Remember to add more information here -->
</body>
</html>

 

Output

HTML

Hide Content

  • Comment also use to hide content .

  • which also help to hide your content / code temporary.

 

For example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Html comment tag</title>
</head>
<body>
    <!-- <p> This paragraph is commented </p> -->
<p>Welcome to teknowize.com</p> 
<!-- <div> This div is commented </div> -->
</body>
</html>

 

Output

HTML