Font looks blurry after translate in Chrome

前端 未结 10 1388
逝去的感伤
逝去的感伤 2020-12-30 20:05

EDIT 2016-07-04(Since this question is getting popular): This is a bug in Chrome. Developers are actively working on a fix.

EDIT 2017-05-14<

10条回答
  •  無奈伤痛
    2020-12-30 20:53

    I've tried different solutions in different, sometimes scary, combinations:

    • translate3d instead of translateY
    • zoom:2; transform: scale(0.5); or zoom:0.5; transform: scale(2);
    • transform: translate(calc(-50% + 0.5px), calc(-50% + 0.5px));
    • -webkit-filter: blur(0);
    • perspective: 1000px
    • scale(1.0, 1.0)
    • -webkit-font-smoothing: subpixel-antialiased;

    none of them work in july 2019.

    The only solution i found for modals, that should be centered - to use a flexbox aligment instead of transform: translate.

    .modal__container {
      display: flex;
      justify-content: center;
      align-items: center;
      position: fixed;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      background: rgba(0, 0, 0, 0.5);
    }
    
      .modal {
        box-sizing: border-box;
        max-width: 80%;
        max-height: 80%;
        padding: 20px;
        overflow-y: auto;
        background: #fff;
      }

提交回复
热议问题