CSS | Comments

Comments 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 */

Comment can be single line or multi-line.

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.



filter_none

edit
close

play_arrow

link
brightness_4
code

<!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>

chevron_right


Output:

Example 2: This example describes the multi-line comment.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!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>

chevron_right


Output:

Supported Browsers: The browsers supported by CSS | Comments are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Apple Safari
  • Opera

full-stack-img




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.