CSS Comments

  • CSS comments are not displayed in the browser, but they can help document for reading source code.
  • Comments are generally used to explain or read the code, and may help when you edit the source code for any future date.
  • The CSS Comments are ignored by browsers.
  • CSS comment is placed inside the <style> element as an internal css method, and starts with /* and ends with */

​​​​​​​​​​​​​​​​​​​​​Example :

<style>
 /* This is a single-line comment */
 p {
  color: red;
 }
</style>
  Try it Yourself

Another Example of CSS Comments

We can add comments wherever we want in the code:

Example :

 p {
  background-color: red; /* Set Background color to red */
 }
  Try it Yourself

Multiple Lines CSS Comments

Example :

/* This is
a multi-line
comment */
p {
  color: red;
}
  Try it Yourself