Html Comments | html comment out tag

Html Comments | html comment out tag





Html Comments | html comment out tag



What is a comment in Html?

Comments are lines of advice or sentences that explain your code in detail. For example, maybe you have an HTML code that Has like navigation so just write before nav tag navigation code start from here and do a comment after complete Html navbar structure you add more comments like navbar end here, so there is the best thing that other developers understand where your navbar code and other and how to find as well 👍.


The power of comments is that it doesn't appear in public but remains in the code only. We will also look through why you should start using comments and why it's a good practice.


How to add a comment in html

Example- 
<!-- Navbar code start form here -->

In code example
 <!-- Navbar code start form here -->  
 <nav>  
  <ul>  
   <li><a href="#">Home</a></li>  
   <li><a href="#">About us</a></li>  
   <li><a href="#">Contact us</a></li>  
  </ul>  
 </nav>  
 <!-- Navbar code end here -->  


The output on the main page is none. This is because as said earlier, there is no public output of comments. Comments are mainly to help explain your code blocks only.

Importance of Comments in Html


Now let's see why it is so important to add comments in code and why it even exists?


We have heard many people say adding comments makes you a better and good coder. But have you ever wondered why they say so?



Let's see an example use case.


Imagine you're working in a coding company. However, one day you decide to resign and leave your job. What happens is that someone else will take over your previous project. When you add comments, this helps them or junior developers to understand what you have coded and how to complete the project.



That is just a real-life scenario. However, honestly, the ultimate reason you should add comments in code is so that you understand your code even better. When you start explaining parts of your code through comments, you will have a clearer understanding of your code.



Thus, that is why you should start using comments in your projects.


Check it more








In this post, we learn What is a comment in Html?. If we made a mistake or any confusion, please drop a comment to reply or help you in easy learning.

Written by - Code With Random/Anki 

Post a Comment

Previous Post Next Post