I am trying to scale the size of a button on hover, but when this is done, the text looks shaky. I looked at some other posts and tried some of the suggestions, such as using -webkit-backface-visibility:hidden;
, transform: translateZ(0);
and -webkit-transform-style: preserve-3d;
, but none seemed to work.
Here is the fiddle: https://jsfiddle.net/ad7n17so/
(I am using Firefox, if that makes a difference)
.button {
margin-left: 30px;
background: #FF0000;
color: #FFFFFF;
padding: 0.4em;
width: 100px;
transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-webkit-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
}
.button:hover {
-ms-transform: scale(1.25); /* IE 9 */
-webkit-transform: scale(1.25); /* Chrome, Safari, Opera */
transform: scale(1.25);
}
Just an FYI for people with shaky/jittery images with transform: scale(1.05)
on :hover on Firefox, this fixed my problem.
transform: scale(1.05) rotate(0.02deg);
So it's totally a fake rotate Firefox hack that stops this glitchy image scale effect.
backface-visibility: hidden;
let the situation better, but the text rendering remains weird (crispy at Firefox, Blurry on Chrome). This problem becomes smaller (mainly on Chrome) removing the padding and using a bigger line-height instead:
.button {
background: tomato;
width: 100px;
-webkit-transition: 0.3s ease-in-out;
-moz-transition: 0.3s ease-in-out;
-o-transition: 0.3s ease-in-out;
transition: 0.3s ease-in-out;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
text-align: center;
line-height: 1.8em;
}
.button:hover {
-webkit-transform: scale(1.25);
-moz-transform: scale(1.25);
-o-transform: scale(1.25);
-ms-transform: scale(1.25);
transform: scale(1.25);
}
<div class="button">Test Button</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With