我想知道为什么 Chrome 和 Firefox 在渲染 CSS 方面存在显着差异。在 Chrome 的情况下,子元素没有占用完整的宽度和高度(可以在子元素的顶部和左侧看到父元素的黑色)。在 Firefox 的情况下,边缘是平滑的,并且子级的尺寸与父级相同。我不知道为什么会这样。
这些是用于演示的 Chrome 和 Firefox 上的屏幕截图:
铬合金:
火狐:
下面是我的代码:
* {
margin: 0;
padding: 0;
}
.parent {
position: relative;
width: 200px;
height: 200px;
border: 10px solid white;
background-color: black;
}
.child {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-color: lightcoral;
}
<div class="parent">
<div class="child">Content</div>
</div>
我只想知道为什么会发生这种情况以及如何修复它以使其在所有浏览器中看起来都一样。
PS:在可用时使用硬件加速是ON

