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.
Syntax:
/* content */
Comments 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 to 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.
HTML
<!DOCTYPE html>
< html >
< head >
< style >
h1 {
color: green;
}
/* Single line comment */
</ style >
</ head >
< body >
< h1 >GeeksforGeeks</ h1 >
< p > A Computer Science portal for geeks </ p >
</ body >
</ html >
|
Output:

Example 2: This example describes the multi-line comment.
HTML
<!DOCTYPE html>
< html >
< head >
< style >
h1 {
color: green;
}
/* This is a multiline
comment */
</ style >
</ head >
< body >
< h1 >GeeksforGeeks</ h1 >
< p > A Computer Science portal for geeks </ p >
</ body >
</ html >
|
Output:

Supported Browsers:
- Google Chrome
- Internet Explorer
- Microsoft Edge
- Firefox
- Safari
- Opera
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
10 May, 2023
Like Article
Save Article