I have some CSS that on hover, a CSS transition effect will moves a div.
The problem, as you can see in the example, is that the translate
transition has the horrible side effect of making the image in the div move by 1px down/right (and possibly resize ever so slightly?) so that it appears out of place and out of focus...
The glitch seems to apply the whole time the hover effect is applied, and from a process of trial and error I can safely say only seems to occur when the translate transition moves the div (box shadow and opacity are also applied but make no difference to the error when removed).
The problem only seems to happen when the page has scrollbars. So the example with just one instance of the div is fine, but once more identical divs are added and the page therefore requires a scrollbar the problem strikes again...
image-rendering
CSS property.<img>
tag using object-fit CSS property.Try this in your CSS:
.your-class-name {
/* ... */
-webkit-backface-visibility: hidden;
-webkit-transform: translateZ(0) scale(1, 1);
}
What this does is it makes the division to behave "more 2D".
backface-visibility
and transform
without the -webkit-
prefix. I currently don't know how this affects other browsers rendering (FF, IE), so use the non-prefixed versions with caution.