Slide 1
Slide 2
Slide 3

Comments in HTML5 (HTML-V35)

No Comments

8. Comments

HTML comments are non-executable lines of code that are not displayed on the web page. They are used to add notes or explanations. It is good practice to add comments to your HTML code, especially in complex documents, to mark each section of the document and leave notes for anyone who reads the code.

HTML comments are completely ignored by web browsers, so they have no effect on how your web page looks or works.

HTML comments help you and others understand your code more easily and improve code readability. They are placed between the <!-- ... --> tags. So any content placed inside <!-- ... --> is treated as a comment and is completely ignored by the browser.

Source Code:

Copied!
<!DOCTYPE html>
<html>
<head>
    <title>HTML Comments Example</title>
</head>
<body>

    <!-- This is a comment -->
    <h1>Welcome to My Website</h1>

    <!-- This section is for the introduction -->
    <p>This is a paragraph on the webpage.</p>

    <!-- The line below is hidden from the browser -->
    <!-- <p>This text will not appear on the webpage.</p> -->

</body>
</html>

Result: 

Watch the video:


Ebook:
https://softkhpc.blogspot.com/2026/11/html-tutorial-beginners.html

back to top