【发布时间】:2018-09-18 22:15:05
【问题描述】:
我有带有背景图像的单元格 (td) 的表格,在移动设备和桌面 chrome 上,如果表格的绝对位置未与圆形像素对齐,它会在 TD 之间显示细线。
// in case you don't see the glitch at 0.5px
var f = 0;
window.onclick = function() {
f += 0.3;
document.body.style.paddingLeft = f + 'px';
document.body.style.paddingTop = f + 'px';
};
body {
background-color: white;
padding-left: 0.5px;
padding-top: 0.5px;
}
table {
border: 0;
border-collapse: collapse;
}
table.image td {
background-image: url(https://ghost.sk/chrome-error/purple.png);
height: 40px;
width: 40px;
}
table.solid td {
background-color: purple;
height: 40px;
width: 40px;
}
div.image {
background-image: url(https://ghost.sk/chrome-error/purple.png);
height: 40px;
width: 40px;
display: inline-block;
}
Table with image bg (glitch both desktop and mobile):
<table class="image">
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
Table with solid bg (glitch usually only mobile):
<table class="image">
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
On mobile it glitches for divs too (more likely with images than solid colors):
<div>
<div class="image">a</div><div class="image">b</div>
</div>
<div>
<div class="image">c</div><div class="image">d</div>
</div>
注意事项:
在演示中我使用 0.5px 初始填充,但在实际代码中我不是故意将其设置为分数,它可以随时发生,例如当居中表格或使用 padding-left 1em 时,这取决于字体。
在演示中,我使用填充纯色的图像来更好地显示它(如果是纯色,我不会使用图像,而且在移动设备上使用纯色时也会显示相同的故障)。
当“clamp to edge”未设置时,“感觉”就像 OpenGL 的错误。
我没有在我的原始设计中使用表格,只是使用表格更容易触发它。
测试平台:Mozilla/5.0(X11;Linux x86_64)AppleWebKit/537.36(KHTML,如 Gecko)Ubuntu Chromium/69.0.3497.81 Chrome/69.0.3497.81 Safari/537.36
【问题讨论】:
-
我无法确认这一点。在我的 1440p/117ppi 显示器上运行良好。
-
这个问题还没有解决。
标签: html css google-chrome