2 ms·
It's really simple. Don't animate layout, especially if your DOM is huge. If your element floats absolutely positioned outside the layout flow, animating heigh
by moritzwarhier 1y ago
It's really simple. Don't animate layout, especially if your DOM is huge.
If your element floats absolutely positioned outside the layout flow, animating height would not be a problem.
And if the browser facilities for animating height/max-height, especially to/from auto, get better, it surely will become more common.
Right now, I wouldn't call it common. It's a common requirement, but only until you start to consider layout.
Fwiw, animating margin and padding is possible and has the capability to cause the same amount of jank as animating height.
- Eric_WVGG 1y agoYou can animate an absolute positioned div without it obviously altering what a normal person would call "the layout." That's not simple unless one is willing to dig very deeply into the how web browser rendering works. And really still not simple. Otherwise this article wouldn't have been written.