这是一个显示我的问题的代码
.container {
width: 200px;
height: 200px;
overflow: auto;
}
.child {
width: 400px;
height: 400px;
/* When scaling down, no more X scrolling because size is 200px, but still Y scrolling :( */
transform: scale(0.5);
/* Both axis working the same (no more scrolling) when absolutely positioned */
/* position: absolute; */
}
/* Irrelevant styling */
.container {
border: 2px solid palevioletred;
position: relative;
}
.child {
background-color: pink;
transform-origin: top left;
}
Run Code Online (Sandbox Code Playgroud)
<div class="container">
<div class="child">
Child …
Run Code Online (Sandbox Code Playgroud)