【发布时间】:2019-07-25 00:01:06
【问题描述】:
我想使一个 div 居中,然后将其缩放(通过 transorm:scale)更大。
我使用 flexbox 使 div 居中。 我想使用整个视图空间,所以我给 HTML 和 BODY 元素设置了 100% 的高度。
在 Firefox 中它呈现得很好。 然而在 Chrome 中,内部 div 的缩放似乎会导致 BODY 元素溢出,并出现垂直滚动条。
如果您在 Chrome 和 Firefox 中运行下面的 sn-ps,您会注意到不同之处:垂直滚动条仅在 Chrome 中出现。我想让它在 Chrome 中看起来就像在 Firefox 中一样(没有滚动条)。
谁能帮我解决这个问题?
html {
height: 100%;
background-color: black;
}
body {
height: 100%;
display: flex;
overflow: auto;
margin: 0;
background-color: antiquewhite;
}
div {
height: 50px;
width: 50px;
margin: auto;
transform: scale(1.7);
background-color: blue;
}
<html>
<body>
<div>
</div>
</body>
</html>
【问题讨论】:
标签: css google-chrome firefox flexbox css-transforms