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

This time I don't get button:hover to work.

I tried different combinations of code to change the color of the buttons when hovering over it, but nothing works. Who knows the right code?

https://w.trhou.se/e69equwd88

2 Answers

Hope you are doing well today, hopefully I can be of some help.

I think the issue here is that you need to change the background color of the .content span as well as the background of .button1. So in order to get the main/top part of your button to change color on hover, you would need to do something like this:

.button1:hover .content {
  background-color: green;
}

This tells the browser than when you hover over your .button1 element, you want it to change the background color of the child .content span, which should do the trick.

Also, you need to remove the box-shadow: 0 6px 0 #06c declaration from your .button1 .content & .button2 .content rule. This declaration is not needed, and it causing your button background to be hidden behind it. So by removing this, you should notice that you can now see the background of the button change to the color you specified.

From here you can tweak the colors however you like, and set up .button2 the same way. Hope this was helpful in solving your issue!

That's awesome, thanks for the answer and clarification.