View video tutorial

CSS Comments

CSS

CSS comments are not displayed in the browser, they help software developers to document.

CSS comments


CSS comments explain the purpose of the code.

This helps developers understand the code later.

Comments are not displayed because they are ignored by the browser./p>

A CSS comment is placed inside the <style> element and begins with /* and ends with */

Single Line Comment

Example

/* This is a single-line comment */
p {
  font-style: italic;
  color: red;
}
Try it Now »

Click on the "Try it Now" button to see how it works.


In-line Comment

Example

p {
  font-style: italic;
  color: red; /* This is a in-line comment */
}
Try it Now »

Click on the "Try it Now" button to see how it works.


Multi-line Comment

Example

/* This is 
a multi-line 
comment */
p {
  font-style: italic;
  color: red; /* This is a in-line comment */
}
Try it Now »

Click on the "Try it Now" button to see how it works.