I can't get a button to change color on hover. Can anyone help here?
Asked
Active
Viewed 1,023 times
-4
-
What have you tried? Evidence of effort on your part will be much appreciated by the denizens of this site. – Kevin Boucher May 12 '15 at 19:07
-
20.01 seconds of google: https://developer.mozilla.org/en-US/docs/Web/CSS/:hover You type it up yourself. We're not here to enable your laziness. – Marc B May 12 '15 at 19:07
-
where is that button/? – Kheema Pandey May 12 '15 at 19:10
-
1possible duplicate of [changing a button color on hover?](http://stackoverflow.com/questions/3898781/changing-a-button-color-on-hover) – Rick Smith May 12 '15 at 19:13
-
1You should check out [how to ask a good question](http://stackoverflow.com/help/how-to-ask). – Gary Storey May 12 '15 at 19:15
-
1This question has nothing to do with Javascript. – Bucket May 12 '15 at 19:32
2 Answers
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
-
1Thank 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