1 回答
TA贡献1824条经验 获得超8个赞
我将你的全容器更改min-height为, 一切height都按你想要的方式运行
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
ctx.fillStyle = "blue";
ctx.fillRect(0, 0, canvas.width, canvas.height);
body{
height: 100%;
overflow: hidden;
}
.full-container {
display: flex;
margin: 0;
padding: 0;
height: calc(100vh - 32px);
}
.footer{
background-color: red;
width: 100%;
height: 32px;
text-align: center;
}
#col1 {
background-color: darkgray;
flex: 0 0 230px;
}
#col2 {
display: flex;
flex-direction: column;
flex-grow: 1;
background-color: aliceblue;
flex: 1 1 auto;
margin: 1px;
padding: 4px;
overflow: auto;
}
#col3 {
background-color: dimgray;
flex: 0 0 230px;
}
<!doctype html>
<html>
<body>
<div class="full-container">
<div id="col1">
hello
</div>
<div id="col2">
<div>
this content scrolls horizontally correctly but not vertically
</div>
<div>
<canvas id="canvas" width="800" height="600"></canvas>
</div>
<div>
other content
</div>
</div>
<div id="col3">
right content
</div>
</div>
<div class="footer">
footer
</div>
</body>
</html>
- 1 回答
- 0 关注
- 82 浏览
添加回答
举报