Skip to content
← Back to Community
CSS
Profile icon
CandySuperCool

Can you comment in CSS? If you can, how?

Answered by Coder100 [earned 5 cycles]
View Answer
Voters
Profile icon
CandySuperCool
Comments
hotnewtop
Profile icon
Coder100
/* comment */
Profile icon
19wintersp

@Coder100 CSS doesn't allow for single line comments like this:

// not a comment

That's valid in SCSS, but not CSS. See the specification.

Profile icon
Coder100

@19wintersp oh oops

Profile icon
CandySuperCool

It works for me, [email protected]

Profile icon
19wintersp

@WilliamXing That's worrying. If you mean that Replit highlights it as a comment; do not trust IDE syntax highlighting, especially Replit's.

Profile icon
Coder100

i think it's because css is forwards compatible @WilliamXing

Profile icon
MatthewADev

/* hi */`

Profile icon
MatthewADev

OK `

Profile icon
MatthewADev

/* hi */'

Profile icon
MatthewADev

/* ok */