CSS Comment

Aug 7, 2017
/* Commenting in CSS */

The one and only way to comment in CSS is using /* comment here */.

/*   Multiline Comment:   - add more css later*/.content {  line-height: 1em; /* comment again */}

No single line comment

Single line comment like // please don't comment like this is not recommended. Though it won't break CSS in some cases, but you will bump into issues when the CSS is minified.

.content {  line-height: 1em; // please don't comment like this}

No nested comment

One of the limitation with CSS comment is you can't do nested comment.

/* nested comment won't work.content {  line-height: 1em; /* nested comment */} */

Less and Sass

You might consider Less and Sass if you want to support single line comment and nested comment.

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.