CSS: transform: translate(-50%, -50%) makes texts blurry

CssTextTransformBlurry

Css Problem Overview


I want to center my div and I use this method, but it makes my texts inside the div blurry:

<!-- language: lang-css -->

#div {
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
}

is there any way to center my div?

Css Solutions


Solution 1 - Css

Add these styles around elements blocks which you are translating to fix the anti-aliasing, Translate Z-axis to have a zero value.

-webkit-font-smoothing: subpixel-antialiased;
-webkit-transform: translateZ(0) scale(1.0, 1.0);

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKen AvilaView Question on Stackoverflow
Solution 1 - Css4dgauravView Answer on Stackoverflow