Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

General Discussion

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 90,980 Points

CSS Comments

Every so often when I'm writing CSS code and doing comments for my code, I like to use them to blank out certain rules, or little notes around code blocks.

And I just wonder, why is there nothing in the specificaton for single line comments.

You can make single line comments in pretty much every programming language I'm aware of but if there's any language, markup or otherwise that is set up for single line comments, it is CSS.

Does this bug anyone else? Anyone know if this is something they might bring in in the future? (Long shot I know)

2 Answers

I hear you Jonathan. Many CSS extension languages like SASS do provide single-line comments as it's definitely a bit of an annoyance. Obviously there are many more compelling reasons to use one of these languages, but that ability alone doesn't hurt. :)

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 90,980 Points

Is it easy to integrate SASS into a CSS file to do this? I'd love to be able to do something to apply single line comments right away :-)

While it's definitely not as easy as just opening up a text editor and writing CSS we do have a course on getting started with SASS. If you're looking to follow along with vanilla CSS examples i'd recommend looking in to SCSS (it comes with SASS and is just an alternative syntax). It looks a lot more like CSS and may be easier of a transition.

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 90,980 Points

I'm looking forward to tacking SASS for the first time in the web design track. Just have to get SEO and Illustrator out the way first lol