Learn HTML Comments


HTML comments are used to insert text that will not effect the HTML elements


When to use HTML comments?


For example, if you created a complex site in the past
with many lines of HTML, and you have to change somthing, comments will be helpful


Or if you want to leave information for another developer you can use comments


This is the comment syntax:


Code Example:

                 
               <!-- Insert comments here -->
    
            


The browser will not display the comment, but you as developer can see them in the source code.


Code Example:

                 
              <!-- Comment -->

<p>Jack Sparrow</p>

<!-- Comment -->
    
            
Try yourself >>



Example of useful comment:


Code Example:

We insert comments, to give additional information about the css elemenets (you can also use comments to explain HTML elements


                    <style>
<!-- size of text -->
font-size: 16px;
<!-- path of search icon image -->
background-image: url('../img/searchic22on.png-3.png');
<!-- size of the search icon -->
background-size: 30px;
</style>
    
            













FreeCodeWiki best site for learning html and css,we offer free lessons of html5 and css3 for beginners, learn html coding online



Navigation