Comments in CSS




Comments in CSS


To comment your CSS style rules is always a great idea because comments helps to give explanation of the code you have done and could be very helpful when you edit your CSS code later on.


Comments are automatically ignored by all the browsers.


CSS comments can be placed within the pair of /*-------*/ tags.



CSS Comments for single line:



span {

    color: blue;
    
/* This is a single-line comment */
    font-size: 14px;

}


CSS Comments for multiple lines:



span {

    color: blue;
    
/* This 

       is a 
       multi-line 
       comment 
    */
    font-size: 14px;

}


Do not nest singleline or any comments within multiline comments. This can lead you for unpredictable errors.



Comments