Why does WebKit text blur when using CSS scale and translate3d?

Patricia Arquette
Release: 2024-11-08 18:26:02
Original
170 people have browsed it

Why does WebKit text blur when using CSS scale and translate3d?

WebKit Text Blurring with CSS Scale and Translate3D

Developers encounter an issue where text rendered in Chrome and other WebKit browsers becomes excessively blurry when CSS scaling (scale or scale3d) is combined with translate3d transformations. This can be observed in a simplified example:

<div class="test">
  <div class="testInner">
    This is blurry in Chrome/WebKit when translate3d and scale or scale3d are applied.
  </div>
</div>
Copy after login
.test {
  -webkit-transform: translate3d(0px, 100px, 0px);
}

.testInner {
  -webkit-transform: scale3d(1.2, 1.2, 1);
  text-align: center;
}
Copy after login

Workaround:

Addressing this issue requires a unique approach as WebKit treats 3D transformed elements as textures rather than vectors. To resolve the blurring, increase the text size and downscale the element, effectively creating a higher resolution texture.

An updated example with this workaround:

<div class="test">
  <div class="testInner">
Copy after login
.test {
  -webkit-transform: translate3d(0px, 100px, 0px);
  filter: scale(0.8);
}
Copy after login

While this approach effectively reduces the blurring, it may still exhibit some antialiasing issues. To mitigate this, text shadow can be added to enhance the text's appearance.

The above is the detailed content of Why does WebKit text blur when using CSS scale and translate3d?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!