我想将div居中,然后缩放(通过transorm:scale)使其更大。
我用flexbox使div居中。
我想使用整个视图空间,所以我给了html和body元素100%的高度。
在firefox中它呈现得很好。
然而,在chrome中,内部div的缩放似乎会导致body元素溢出,并出现一个垂直滚动条。
如果你在chrome和firefox中运行下面的代码片段,你会注意到不同之处:垂直滚动条只在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>