No, I’m not talking about /*these comments*/ , I’m talking about //these comments , the ones every other language supports.

(Except HTML.)

You’ve probably been told that no, CSS does not support single-line comments. The only way to leave a comment in CSS is with the slash-asterisk-asterisk-slash comments, like so:

div {
background-color: red; /*red makes people hungry*/
width: 200px;
}

You will find those claims on CSS TricksMDN and W3Schools (boo, I know). But what if I said those claims are false?

Please…

If you try something like this:

div {
background-color: red; //red makes people hungry
width: 200px;
}

It hides the proceeding style (aka the width). With this in mind, we could do something like this:

div {
//background-color: red; red makes people hungry
width: 200px;
}

Which would hide the background color… except it doesn’t. It hides the width, since that is the proceeding style. So you’d need to do this to comment out the background-color:

#css3 #css #web-design #web-development

Does CSS Support Single-line Comments?
1.45 GEEK