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

HTML How to Make a Website Responsive Web Design and Testing Website Testing

Joe Williams
Joe Williams
4,014 Points

What was the keyboard shortcut on a Mac to switch a line of CSS from code to a comment?

I know Nick mentioned it in a video, but I don't remember which, and Google isn't being too helpful.

2 Answers

Sreng Hong
Sreng Hong
15,083 Points

It's an a Mac shortcut. It's a text editor shortcut, but I'm sure that all the editors have that.

All you do is to select the code you want to comment and hit command + /

It works in most editors such as Workspace, Sublime, Bracket, Textmate...

Hope this helps.

Joe Williams
Joe Williams
4,014 Points

This is exactly what I was looking for. Thanks!

Shawn Flanigan
PLUS
Shawn Flanigan
Courses Plus Student 15,815 Points

I'm not sure about a keyboard shortcut, but you can comment out a line of css by adding two slashes (//) to the beginning of your line. If you want to span multiple lines, start with /* and end with */ and anything in between will be a comment.