2019 年更新
Chrome 显示错误仍未修复,尽管不是顾客的错,但本网站提供的全部建议都无法解决该问题。我可以同意,我徒劳地尝试了其中的每一个:只有 1 个接近,这就是 css 规则:filter:blur(0); 这消除了容器 1px 的移动,但不能解决容器本身及其可能具有的任何内容的模糊显示错误。
现实是这样的:这个问题实际上没有解决办法,所以这里有一个针对流动网站的解决方法
案例
我目前正在开发一个流畅的网站,并有 3 个 div,所有这些 div 都以悬停效果为中心,并在宽度和位置上共享百分比值。Chrome 错误发生在设置为 left:50% 的中心容器上;和变换:translateX(-50%); 一个共同的设定。
示例:首先是 HTML...
<div id="box1" class="box">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry"s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
</div>
<div id="box2" class="box">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry"s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
</div>
<div id="box3" class="box">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry"s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
</div>
这是发生 Chrome 错误的 CSS ......
*{margin:0; padding:0; border:0; outline:0; box-sizing:border-box; background:#505050;}
.box {position:absolute; border:1px solid #fff; border-radius:10px; width:26%; background:#8e1515; padding:25px; top:20px; font-size:12pt; color:#fff; overflow:hidden; text-align:center; transition:0.5s ease-in-out;}
.box:hover {background:#191616;}
.box:active {background:#191616;}
.box:focus {background:#191616;}
#box1 {left:5%;}
#box2 {left:50%; transform:translateX(-50%);} /* Bugged */
#box3 {right:5%;}
这是固定的CSS...
*{margin:0; padding:0; border:0; outline:0; box-sizing:border-box; background:#505050;}
.box {position:absolute; border:1px solid #fff; border-radius:10px; width:26%; background:#8e1515; padding:25px; top:20px; font-size:12pt; color:#fff; overflow:hidden; text-align:center; transition:0.5s ease-in-out;}
.box:hover {background:#191616;}
.box:active {background:#191616;}
.box:focus {background:#191616;}
#box1 {left:5%;}
#box2 {left:37%;} /* Fixed */
#box3 {right:5%;}
错误的小提琴: https : //jsfiddle.net/m9bgrunx/2/
固定的小提琴: https ://jsfiddle.net/uoc6e2dm/2/
正如您所看到的,对 CSS 的少量调整应该会减少或消除使用变换进行定位的要求。这也适用于固定宽度的网站以及流动的网站。