Tsallaka zuwa abun ciki
Justice Tech School

CSS Comments

A CSS comment starts with /* and ends with */. It can span several lines. Browsers ignore everything inside it.

Use comments to label sections of a long stylesheet, explain unusual tricks, or temporarily switch off a declaration while debugging. CSS has no // comment style.

Example
<style>
  /* Heading styles */
  h1 { color: purple; }
  p {
    color: gray;
    /* font-size: 30px; (switched off) */
  }
</style>
<h1>Title</h1>
<p>The font-size line is commented out.</p>

Exercise

Finish the comment so the rule below still works.

/* Page title 
h1 { color: navy; }

Quiz Test

Which is the correct CSS comment?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.