In this post, we will learn how to write comments in HTML. Comments are not executed by the browsers so we are not seen comments. Comments are very useful to find any specific code very quickly. So we should make habit to writing comments.


How To Write Comments in HTML ?


Write Comments in HTML

To write comments in HTML we use this syntax <!-- This is HTML Comment -->


We can use this syntax for both single line comment or multiline comment. This HTML comment start with <!-- and ends with --> .


We can also use any number of dashes between <! or > . 


Examples of HTML comments are as follows:

<!DOCTYPE html>
<html>
<head>
<title>How To write Comments in HTML ?</title>
</head>
<body>

<h1>HTML Comments Examples</h1>

<!-- This is an example of single line HTML comment -->

<!-- This is an example of a

multiline HTML comment -->

<!------------ This is an example of using any number of dashes. ---------->

</body>
</html> code-box


Summary

In this post we learned how to write comments in HTML. You try to make it yourself. I hope you make. If you face any problem, then comment and tell us. Keep visiting the blog to read more similar posts.

Post a Comment

Previous Post Next Post