LOGBOOK

HELP

Quiz Entry - updated: 2026.06.20

What is the syntax for CSS comments, and why use them?

CSS comments are written /* ... */; CSS has no // single-line form, and comments are for explaining and temporarily disabling code.

The browser ignores anything between /* and */, on one line or spanning many:

/* a single-line note */

/*
   a multi-line
   comment
*/

There is no // comment in CSS — that is a common slip carried over from JavaScript, and writing // will break the rule that follows it.

Comments earn their keep in a few ways:

/* ============================
   Header styles
   ============================ */
.header {
    background: navy;
    /* TODO: add a responsive breakpoint here */
}

/* temporarily disabled while debugging:
.old-class { color: red; }
*/
  • Organise a long stylesheet into labelled sections so it stays navigable.
  • Explain the "why" behind a non-obvious value or a tricky selector — the code already shows the "what".
  • Disable code quickly while debugging, by wrapping it in /* */ instead of deleting it.

A small caution: comments do not nest, so wrapping an already-commented block in another /* */ ends the comment early at the first */.

From Quiz: WEBT / CSS Basics | Updated: Jun 20, 2026