-4

I can't get a button to change color on hover. Can anyone help here?

Stefan Kendall
  • 66,414
  • 68
  • 253
  • 406
Pavel
  • 11
  • 1
  • 8

2 Answers2

1

There are several ways to make a button. I'm guessing you're not styling the right one.

input[type=button]:hover,input[type=submit]:hover,button:hover
{
  background-color: red;
}
Stefan Kendall
  • 66,414
  • 68
  • 253
  • 406
1

Pretty simple stuff. In the future please add the code you are having trouble with in your question, so it will be easier for us to help.

CSS:

.btn {
  background:#fff;
  }

.btn:hover {
  
  background:#f00;
  }

HTML

<button class="btn">Button</button>
John Harding
  • 432
  • 1
  • 6
  • 14
  • 1
    Thank You! Im new to StackOverflow and wanted to know this because its part of my project for school! – Pavel May 12 '15 at 19:24
  • No problem! Welcome to SO! After asking your question and getting the answer you were looking for, make sure to select that answer as the correct answer by clicking on the check mark to the left of the post. It helps people find answers in the future! – John Harding May 13 '15 at 21:47
  • Hey Pavel, don't forget to choose an answer when your problem has been solved! If it hasn't been solved, please update your question! – John Harding May 19 '15 at 23:20