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进行少量调整可以减少或消除使用transform进行定位的要求。这也可能适用于固定宽度的网站以及流畅的网站。