Comments help programmers.
➔ Comments are the notes for the code of its purpose.
➔ Comments are not displayed when the page is rendered.
➔ It is useful to understand the code function or objective after a long time.
➔ In production comments are deleted.
<!-- Write your comments here -->
Learning with HTML Editor "Try it Now"
You can edit the HTML code and view the result using online editor.
Adding a comment
The comment can be added anywhere (inline comments or individual lines) in the html document.
Example
<h2>HTML Comment Example.</h2>
<!-- This is a comment -->
<p>Welcome to w3context.</p>
<!-- Comments are not displayed on the html page when rendering. -->
Click on the "Try it Now" button to see how it works.
Inline comment
Example
<!DOCTYPE html>
<html>
<head>
<title>HTML Inline Comment Example</title>
</head>
<body>
<h2>HTML Inline Comment Example.</h2>
<p>Welcome <!-- inline comment goes here --> to w3context.</p>
<!-- Comments are not displayed on the html page when rendering. -->
</body>
</html>
Click on the "Try it Now" button to see how it works.
Hide Code
The comment can hide any html code in the document.
Example
<!DOCTYPE html>
<html>
<head>
<title>HTML Commenting Code Example</title>
</head>
<body>
<h2>HTML Commenting Code Example.</h2>
<!-- The line below is commented -->
<!--<p>Welcome to w3context.</p> -->
<p>Note: Comments are not displayed on the html page when rendering.</p>
</body>
</html>
Click on the "Try it Now" button to see how it works.