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 The Selectors Solution

Kate Wilson
Kate Wilson
2,915 Points

Here is how I made the button change colors when active: .button:active { background-color: red; } What's wrong?

Can someone please explain why this is a bad idea? I guess it would change all the buttons and this might not be a good thing? Thank you!

2 Answers

Kate Wilson
Kate Wilson
2,915 Points

Thank you for explaining it!! Makes sense!

Steven Parker
Steven Parker
218,487 Points

Kate Wilson — normally you'd set "best answer" on the one that helped resolve the question! :see_no_evil!:

Steven Parker
Steven Parker
218,487 Points

This would only change the active color on the items you give the class "button" to. It's not a "bad idea" from the standpoint of overall design, but this particular exercise was to practice creating selectors for existing HTML (and not changing the HTML itself).

So since this technique requires altering the HTML to add the class, it's not within the scope of this practice exercise.