Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML CSS Buttons Hover Wont Work Through Class

I don't understand why does this work :

.button:active {
    position:relative;
    top: 2px;
    left:2px;
}

But this wont work :

.button:hover { 
    font-size:17px;
}

It works when I use id but I want it to activate for all buttons :

#btnhome:hover{
    font-size:17px;
}

This works fine but with class it wont? What am I doing wrong?

like image 679
user1880779 Avatar asked Jul 18 '26 04:07

user1880779


1 Answers

Using id and it works so sure something has to do with the specificity, over riding, try this

Demo

Demo + !important

.button:hover { 
    font-size:17px !important; /* Actually you don't even need !important */
}
like image 132
Mr. Alien Avatar answered Jul 21 '26 04:07

Mr. Alien



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!