HTML tag
The <!-- ... --> tag is used to insert comments in HTML. Its content is ignored by browsers and is not displayed on the page. However, the comments are visible to anyone who views the page source code.
HTML comments point out document sections or insert notes explaining the code. The comment tag can also be used to exclude short-term code blocks instead of deleting them.
Comments can be used almost anywhere in a document. However, placing them inside the <title> tag will cause the comment markers to be parsed as literal text and displayed in the browser tab.
Syntax
Comments are written between <!-- and --> symbols.
Example of the HTML comment tag:
HTML tag
<!DOCTYPE html>
<html>
<head>
<title>Example of using the comment tag.</title>
</head>
<body>
The content of the page.
<!-- This is our comment, that is not displayed on the browser. -->
</body>
</html>Result

The comment tag can be used for “hiding” scripts from browsers without any support for scripts.
JavaScript comment
<script type="text/javascript">
<!--
function displayMsg() {
alert("Comment tag")
}
//-->
</script>In the example above, the two forward slashes at the end of the line (//) are the comment symbol in JavaScript. This prevents JavaScript from interpreting the --> as code.
Note: HTML comments cannot be nested. Using <!-- <!-- --> --> will break the comment structure. For modern browsers, you can simply use JavaScript block comments (/* ... */) inside the <script> tag instead of this legacy technique.
The comment tag doesn’t support the Global Attributes.
Practice
Which of the following statements about HTML tags are correct based on the information provided in the given URL?