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 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
231,248 Points

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

Steven Parker
Steven Parker
231,248 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.