Using transform scale causes blurry text only on Windows Chrome

半世苍凉 提交于 2019-12-13 08:42:42

问题


I have run into a pretty frustrating problem regarding the CSS transform scale. I have a block of text which I would like to zoom by 105% on hover and it is causing blurriness of the text, but only on the Windows version of Chrome. I found this question and tried the various solutions provided there, but I still cannot get it to work as desired.

body, html {
  font-family:'Open Sans', sans-serif;
}
.zoom {
  transition:transform .5s;
  width:300px;
  margin:50px auto;
}
  .zoom:hover {
    transform: scale(1.05) translateZ(0);
    will-change:transform;
  }
  .zoom h4 {
    font-size:2rem;
    line-height:2.5rem;
    -webkit-font-smoothing:antialiased;
    backface-visibility: hidden;
    -webkit-filter: blur(0);
    filter: blur(0);
    margin:0;
    text-transform:uppercase;
  }
  .zoom p {
    -webkit-font-smoothing:antialiased;
    backface-visibility:hidden;
    -webkit-filter:blur(0);
    filter:blur(0);
    margin:0;
  }
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
<div class="zoom">                  
  <h4>Lorem Ipsum</h4>
  <p>Lorem ipsum dolor sit amet, conse ctetur adipiscing elit…</p>
</div>

As I mentioned earlier, this only seems to be an issue on the Windows version of Chrome. On Chrome for OSX, FireFox and even IE this issue does not occur. I am open to using a different solution than transform, provided the animation has a transition as it does in my example. I would, however, like for it to be a CSS only solution.

Any ideas?


回答1:


I can't test it myself right now as I don't have a Windows computer handy, but maybe you can do either solutions:

  1. Adding backface-visibility: hidden; to .zoom
  2. Changing your transform on .zoom:hover property to transform: scale(1.05) translateZ(0);

This should trigger GPU material acceleration and just might solve your issue on Chrome. No promises, though. Good luck!



来源:https://stackoverflow.com/questions/43455815/using-transform-scale-causes-blurry-text-only-on-windows-chrome

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!