HTML Comment
HTML comments are used to add notes, explanations, or temporary code
that won't be displayed on the webpage. These comments are useful for
developers to leave reminders or to prevent certain code from being
executed while debugging.
Syntax:
<!-- This is a comment line -->
Important Notes About HTML Comment:
- They do not appear in the browser's rendered webpage, but are visible in the page's source code.
- Comments can't be nested, meaning you can't place a comment within another comment.
- They are often used to temporarily remove parts of code or to provide notes in a project without affecting the webpage's functionality.
Uses Of Comment:
- Leaving documentation or notes for other developers.
- Temporarily disabling parts of the code during debugging.
- Organizing or labeling sections of code to improve readability.
Example:
<!DOCTYPE html>
<html>
<head>
<title> HTML Comments</title> </head>
<body>
<!-- This is a comment --> <p>This is a paragraph.</p>
<!-- Comments are not displayed in the browser --> </body>
</html>
Output:
More topic in HTML