Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialRobert Glover
20,115 PointsWhy doesn't // (two slashes) comment out the text? Isn't that still valid CSS?
Why doesn't // (two slashes) comment out the text? Isn't that still valid CSS?
3 Answers
Manish Giri
16,266 Points//
is a valid comment in JavaScript. For CSS, it's /* ... */
Nick Bollard
3,432 PointsYou can use // to comment out CSS. Most browsers support this. It works for Google Chrome for example, but is not part of the official CSS standard. I guess this is why it's not taught at Treehouse. https://stackoverflow.com/questions/12298890/is-it-bad-practice-to-comment-out-single-lines-of-css-with
Muhammad Khan
Courses Plus Student 8,772 PointsHi there, For CSS we use /* This Comment is for CSS */. // (two slashes) comment out the text is used for Programming languages like JavaScript, Java, C# etc.
Hope this helps!