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

jose macedo
jose macedo
6,041 Points

how do you make your buttons background color change orange when you hover over them???

how do you make your buttons background color change orange when you hover over them???
ive tried a couple things and it doesn't seem to work

https://w.trhou.se/7osskc34ax https://w.trhou.se/7osskc34ax https://w.trhou.se/7osskc34ax

3 Answers

Hannu Shemeikka
Hannu Shemeikka
16,799 Points

Hi,

You use pseudo-class hover.

Example

<!-- html -->
<button class="buttons">button</button>

// css
button:hover {
  background-color: orange;
}
Sam Koster
Sam Koster
3,982 Points

Just add a hover psuedo-class.

For example:

HTML

<button class="mybutton"> My Button </button>

CSS

.mybutton {
  background: tomato
}

.mybutton:hover {
   background: teal; 
}
Erlens Mitrofanovs
Erlens Mitrofanovs
6,757 Points

I hope I got Your question right!

button:hover { background: orange; }