All TalkersCode Topics

Follow TalkersCode On Social Media - A Social Media Network for developers Join Now ➔

How To Make A Comment In HTML

Last Updated : Mar 11, 2024

How To Make A Comment In HTML

In this tutorial we will show you how to make a comment in HTML, comments are most important feature of html. Comments are generally used by designers to hide something special content, and it may be simple lines that helps another designers to understand that is done inside the code.

We can use inline comments, single line comments and multiline like paragraph contents in html. The content written inside the comment tags is not shown on browser. We see these comment only when we see or go through source files only.

Step By Step Guide On How To Make A Comment In HTML :-

1. By using comment tag:

As, comment as used for many purposes and used by different ways by a designer in his/her webpage.

So, we go through an example to understand how different comments works and learn about them through html code .A general use of comment tag with the help of codes is given here...

<!DOCTYPE html>
          <title> Title of the document<title>
              <!-- comment starts here -->
            two comments for developers understanding
        <!-- comment ends here -->
            <!-- this is the -->
            <!-- we can use two or more comments as we wish -->
            <!-- kjfdklja 
            this is the multiline comment.
  1. First, we write <! DOCTYPE html> which we used as an instruction to the web browser about what version of HTML file is written in.
  2. Secondly, the <html> tag is used to indicate the beginning of an HTML document.
  3. As above now <head> tag is used to contain information about web page. In this tag a <title> tag is used which helps us to specify a webpage title. Both <head> and <title> tags are Paired tags. So, both have </head> and </title> ending tags respectively.
  4. Thirdly, <body> tag is used to define the webpage body. All the contents to show on website are written here. Here in this code, first we use comments that are actually used by a designer for another.
  5. Secondly, the next comment that is used is inline comment it may be one, two or more and this comment is used inside tags and also inside content to help and used to hide secret codes also.
  6. And lastly, the third type of comment is multiline comment it is same as other comment but the lines of comments are more than one, o its known as multi line comment.
  7. For comment we have some shortcut keys. To use these, first we write line which is to be commented and type ctrl+/ or ctrl+k. which ide u use may have different key to make a text comment. But mostly used keys are these two.
  8. At last, the <body> and <html> tags are closed with </body> and </html> respectively.

Conclusion :-

As the <! -- -- > tags are used to make a text comment. Comments are important feature of html and it seems to be very helpful.

As first when we are as beginner then we are not able to come in touch properly but after sometime it seems to be very helpful to you also. I hope this tutorial on how to make a comment in HTML helps you.