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 trial

CSS

Yuri Lee
Yuri Lee
1,451 Points

Difference between /* Content */ and <!-- Content --!>

Hi, I am watching a video on CSS Comments and got confused about its shortcut. In order to opt out contents, I am supposed to use Command key + / but it comes up with <!-- --!> instead of /* / as shown on the video. I am curious what's the difference between them and how I can make it work as / */. (I assume that they play the same role though.) Thanks a lot!

1 Answer

Steven Parker
Steven Parker
231,248 Points

These are comment identifiers for two different languages. The "<!-- --!>" sequence is for comments in HTML code, and the "/* */" sequence is for CSS code.

If you have both kinds of code in the same file (such as when you use <script> tags), it's possible that your editor has a bug and it got confused about what kind of code was being entered on that line.

Yuri Lee
Yuri Lee
1,451 Points

Thank you so much! This answer was very helpful :-)