The Comments in CSS, are the statements in your code that are ignored by the compiler and are not executed. Comments are used to explain the code. They make the program more readable and understandable.
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML course.
/* content */
Comment can be single-line or multi-line. The /* */ comment syntax can be used for both single and multiline comments. We may use <!– –> syntax for hiding in CSS for older browsers, but this is no longer recommended for use. Adding comments in the code is a good practice that can help to understand the code if someone reads the code or if it is reviewed later.
Note: The outputs are the same because comments are ignored by the browser and are not interpreted.
Example 1: This example describes the single-line comment.
Example 2: This example describes the multi-line comment.
- Google Chrome
- Internet Explorer
- Microsoft Edge