HTML Comments

HTML Comments

HTML comments are text,phrases or sentences inside an HTML file.

They are only shown in codes and not rendered by a browser.


Why use HTML Comments?

HTML comments help both beginners and experienced web developers to easily organize their codes.

They act like sticky notes in HTML files.


How to write HTML Comments?

An HTML comments starts with <!-- and ends with -->.

It looks like this:

<!--comments go here -->


Example:

<!doctype html>
<html>
<head>
    <title> HTML Comments </title>
</head>
<body>
    <p>Sentences shown on browser.     
       <!-- single line comment -->
    </p>
    <p>Sentences shown on browser.
       <!-- this is a multi-line comment.
       some phrases go here
       some phrases go here -->
    </p> 
</body>
</html>


Output:

    Sentences shown on browser.

    Sentences shown on browser.

On the example given above,you have learned that you can make a single line and multi-line of HTML comment.





    
                                                                                

Post a Comment

Post a Comment (0)