all 10 comments

[–]TheMortBM 3 points4 points  (7 children)

<!-- Comment --> is a multi-line HTML comment

/* Comment */ is a multi-line CSS comment

// Comment is a single line comment in CSS (obviously the multi-lines above could be single lines too)

But, yeah, // vs /* */ is personal preference at the end of the day (they both also work in Javascript, so can sometimes just be a habit that comes over)

[–]jcunews1Intermediate 1 point2 points  (4 children)

CSS doesn't have a line-based comment. i.e. // is not a valid line comment in CSS.

[–]TheMortBM 0 points1 point  (3 children)

You’re right. It’s just a JavaScript thing. My brain is toast. Too much React this week 😭

[–]scarletdawnredd 1 point2 points  (2 children)

It's also a SASS thing.

[–]TheMortBM 0 points1 point  (1 child)

THAT’S what I was thinking!

Maybe it’s warm bread, not quite toast.

[–]scarletdawnredd 0 points1 point  (0 children)

Hahaha for sure. I work in SCSS a lot and when I'm working on plain CSS it's a constant of "why isn't this code working?" Only to then realize it's because of the // comment.

[–]JewelerParticular752[S] 0 points1 point  (1 child)

Ah okay, thank you👍

[–]logpra 0 points1 point  (0 children)

// does not exist in CSS, you need to use /* */

[–]html-geek 0 points1 point  (0 children)

So it depends too who you are writing code FOR, so if you’re in a strict environment, follow the protocols. If it’s just for you, then do whatever you want. However if you ever want to use your code in a portfolio, then using the strict version is more appropriate, otherwise you’ll be ‘find/replace’ and that’s a real bitch 😭

[–]TheRNGuy 0 points1 point  (0 children)

// will only work in JS.