【发布时间】:2015-05-22 11:57:56
【问题描述】:
我的 CSS3 按钮在某些用例中无法正确显示。在 FF 和 Safari 中,它们显示良好,但在 Chrome 中,左侧边框较厚,当您将鼠标悬停在它们上方时,填充颜色不会填充 100% 的区域。查看一个工作示例:http://jsfiddle.net/3x4zc8tq/3/ 我该如何解决?
/* @group Center all the things */
.center-wrapper {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
}
.center-wrapper .center {
position: relative;
overflow: hidden;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
/* This fixes the blurred buttons but breaks centering
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
transform: translateZ(0);*/
}
/* @end */
以下经过试验和测试的方法对我不起作用:
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
transform: translateZ(0);
【问题讨论】:
-
效果不错。虽然在这里没有看到 Chrome 的任何问题。你没有任何机会放大,是吗?尝试按
CTRL+0进行确认。 -
看起来不错。您使用的是哪个版本的 chrome?
-
在 Chrome 中没问题,但在 Safari 中,按钮并没有完全填满。
-
我可以确认我的 Chrome 中也发生了这种奇怪的行为。没有放大,没有插件或插件。
-
问题是所有翻译和奇数视口宽度的组合。当视口具有均匀宽度时,按钮会正确呈现。 Chrome 将元素捕捉到设备像素,并且舍入不正确。