Previous Next

CSS Comments

CSS comments are utilized to offer explanations or notes within the CSS code. Comments have no influence on the style or structure and are ignored by the browser. Comments are surrounded between /* and */.

There are two types of comments in CSS:

Single-line comments

Single-line comments are denoted by /* and */. Whatever information is placed between /* and */ will be considered a comment and not executed by the browser.

Example:

/* This is a single line commnent */
p {
  color: red;
}

Multi-line comments

Multi-line comments take up multiple lines and are ideal for complex explanations.

Example:

/* This is a
multi line
commment */

h2 {
  color: red;
  text-align: center;
}
Previous Next