Safari changing font weights when unrelated animations are running

后端 未结 3 579
梦谈多话
梦谈多话 2020-12-04 11:00

I\'m using css animations on my page and Safari seems to change unrelated font weights elsewhere on the page when animations are running. Any idea why this happens? All othe

3条回答
  •  长情又很酷
    2020-12-04 11:36

    Apparently, that's the price you pay for hardware acceleration: all text momentarily turns into images, which causes the drop in render quality.

    However, applying html {-webkit-font-smoothing: antialiased} to turn off the sub-pixel anti-aliasing makes this problem go away. That's what I'm doing for now.

    UPDATE: Since then, I've also come to learn that this happens only when the browser can't be sure if the section being animated is going to affect the text. This can usually be handled by having the text above (higher z-index than) the elements being animated, and/or making sure the text has a fully opaque background.

提交回复
热议问题