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.

CSS

Drew Butcher
Drew Butcher
33,160 Points

CSS vs CoffeeScript

In the video

http://teamtreehouse.com/library/programming/build-a-simple-ruby-on-rails-application/frontend-development/adding-interactivity

Jim Hoskins adds some CoffeeScript to include a class on the action of hover. My question is: why not just use the suddo class of hover. In other words, in the css file I would have written:

.status:hover .admin {
    display: inline;
}

.status:hover {
    background: #FAFAFA;
}

The end result is the same. Is there an advantage or disadvantage to using the CoffeeScript?

Many thanks, Drew Butcher

2 Answers

I originally thought it was so that when someone hovers over all the whitespace to the right in the status fields, the jQuery would cause the hover effect where CSS wouldn't. However I tested it, and you're right Drew, CSS works pretty much the exact same way. Maybe it was just to intro a bit of coffescript, I s'pose.