Learn HTML Comment Tag Step-by-Step with Examples

 how to use comment  tag in html 

how to use comment  tag in html

✅  What is Comment TAg HTML

1)  The comment tag in HTML is used to add notes, explanations, or reminders inside your code that are not visible on the webpage. It is very helpful for developers to understand the code better and keep it organized.

2) The syntax of the HTML comment tag is:

<!-- This is a comment -->

3) Anything written between <!-- and --> is ignored by the browser, which means users cannot see it on the website.

4) Comments are especially useful when working on large projects or in teams. Developers use them to explain code sections, give instructions, or temporarily disable parts of the code without deleting them. For example, you can comment out a line of code while testing something new.

5) You can place comments anywhere in your HTML document, such as inside the <head> or <body> section. However, it is important not to overuse comments, as too many can make the code messy and difficult to read.

6) Also, remember that comments are visible in the page source, so you should never include sensitive or private information.

Syntax 

<!-- This is comment tag -->

<--   :-  comment starts

-->   :- Comment ends


how to use comment  tag in html 

Example 


<!DOCTYPE html>
<html>
<body>

<!-- This is a comment -->
<p>Web Designing theory blogger (webdesigningtheory.blogspot.com)</p>
<!-- Comments are not displayed in the browser -->

</body>
</html>

how to use comment  tag in html 

Explain Program

Step 1 ]

<!Doctype html>

<!doctype html>  always be the first line of any HTML document.

Step 2 ]

   <html> and </html>

   html  is the root element.

Step 3 ]

<body> and </body>

body  is  main content area.

All visible content inside to  the <body> tag

Step 4]

<!-- This is a comment -->

html comment 

comments are not visible on the webpage.   

they are only seen in the code.

Step 5]

<p>Web Designing theory blogger (webdesigningtheory.blogspot.com)</p>

paragraph tag . displays the text  web designing theory blogger ( webdesigningtheory.blogspot.com )

display webpage.

Step 6]

closing the Tag


</body>

 </html>

how to use comment  tag in html 

Output

how to use comment  tag in html

Related Post :-

how to use the html button input

how to create ordered lists in html

html alignment tag

No comments

Powered by Blogger.