CSS Transform causes flicker in Safari, but only when the browser is = 2000px wide
Frustrating huh?
See EDIT4 for the answer to why 2000px is a magic number.
There is a couple of things you can try.
Add
-webkit-transform-style: preserve-3d;
to the elements that are
flickering.add
-webkit-backface-visibility: hidden;
to the elements that are
flickering.move the animating element outside of the parent the flickering
elements are within.
EDIT —
Wesley Hales, said here
"I encountered glitchy behaviour when applying hardware acceleration to parts of the page that were already accelerated"
Its hard to help you debug this without any code. But for starters I suggest you turn on debug mode in safari. Write 'defaults write com.apple.Safari IncludeInternalDebugMenu -bool true' in the terminal.
After this a Debug menu will show up. Choose Drawing/Compositing flags > Show Compositing borders.
This will help you see whats being rendered and by that choose what to put in hardware acceleration and what to leave out.
EDIT2 —
This is worth checking out as well: fast-animation-with-ios-webkit
Its regarding iOs, but I've experienced that - in some circumstances - solutions that work on iOs also works on osx.
EDIT3 —
If you are just asking what happens when its bigger than 2000px I can tell you for sure that on iPhones, WebKit creates textures that are no larger than 1024 by 1024, and if your element is larger than that, it has to create multiple textures.
Documentation on texture limitations
Now, when they do it on iPhone, it wouldn't surprise me if they do the same on OsX, but has a higher limit.
Don't know if this is your case tho. Impossible to tell without any code.
EDIT4 —
"The implementation in TextureMapperTiledBackingStore is pretty simple, and is used only to work around the 2000x2000 texture size limitation in OpenGL."
So, if your element is bigger than 2000x2000 it has to create multiple textures.
http://trac.webkit.org/wiki/CoordinatedGraphicsSystem
Prevent flicker on webkit-transition of webkit-transform
The solution is mentioned here: iPhone WebKit CSS animations cause flicker.
For your element, you need to set
-webkit-backface-visibility: hidden;
Why does my transform: translateY flicker in Chrome?
Placing the following code in the element with the transform property should solve:
-webkit-perspective: 1000;
-webkit-backface-visibility: hidden;
In your case:
a {
display: inline-block;
transition: transform 333ms ease;
&:hover, &:focus {
transform: translateY(-1rem);
-webkit-perspective: 1000;
-webkit-backface-visibility: hidden;
}
}
Related Topics
Printing HTML Tables, Preventing Rows from Spanning Multiple Pages
How to Shift the Text in Twitter Bootstrap Navbar to Center
Are Margin and Padding Most Disbalanced Thing Among All Browser
Why Can't Inline Elements Be Transformed
Animate Text Fill from Left to Right
CSS Keep All Flexbox Children Elements the Same Size
Css: Before/After Content with Title
Safari and Chrome Ignore Min-Width CSS Propery
How to Override Max-Width for Specific Div
Overflow:Hidden on Body Is Broken in iOS6
In CSS, How Does Overflow Interact with Float
Position Div Center Horizontal and Vertical
CSS Animated Circles - Stop Center Content from Rotating