Professional Documents
Culture Documents
Silky CSS: Minimizing Repaints & Jank
Silky CSS: Minimizing Repaints & Jank
Aside from looking great and loading quickly, the perfect website
should also feel smooth. The act of scrolling down the page should
be more luxury sedan and less go-kart. Animations should be like
butter and silk having a night out together. While the average visitor
might not consciously notice smooth rendering performance, they
most certainly notice its absence. In this post, I want to discuss one of
the more surprising culprits of website choppiness (also known as
“jank”) and how to avoid it whenever possible.
https://trendyminds.com/blog/silky-css-minimizing-repaints-jank 1/6
24/08/2019 Silky CSS: Minimizing Repaints & Jank | TrendyMinds
These four steps build upon each other, which means the higher up
the chain our CSS reaches, the more dominoes we are knocking
down for the browser to pick up again . . . every 16.67 milliseconds.
https://trendyminds.com/blog/silky-css-minimizing-repaints-jank 2/6
24/08/2019 Silky CSS: Minimizing Repaints & Jank | TrendyMinds
We ideally want our CSS to only touch the final step, as this allows
for maximum browser laziness (i.e. silky, jank-free performance).
Repaints
Reflows
https://trendyminds.com/blog/silky-css-minimizing-repaints-jank 3/6
24/08/2019 Silky CSS: Minimizing Repaints & Jank | TrendyMinds
Position
Size
Color
forces a repaint on every frame while the user scrolls. To avoid these
costly repaints, apply the background image to an element without
specifying a background-attachment, make sure this element is
behind any actual content (z-index) and then apply “position: fixed” to
said element.
If you want to learn more about which effects on your pages are
creating choppiness, I recommend spending some quality time with
Chrome’s Developer Tools. In particular, make sure that your drawer
is visible and then navigate to the “Rendering” tab and check the
“Show paint rectangles” box.
https://trendyminds.com/blog/silky-css-minimizing-repaints-jank 5/6
24/08/2019 Silky CSS: Minimizing Repaints & Jank | TrendyMinds
Resources
https://trendyminds.com/blog/silky-css-minimizing-repaints-jank 6/6