【发布时间】:2020-04-05 02:30:31
【问题描述】:
如果我在 HTML 中有以下代码:
<!DOCTYPE html>
<html>
<head>
<title>test</title>
<style>
.container {
display: flex;
flex-direction: row;
}
.left {
height: 100%;
display: block;
width: 50%;
background-color: green;
overflow-y: scroll;
}
.right {
height: 100%;
background-color: red;
display: block;
width: 50%;
overflow-y: scroll;
}
</style>
</head>
<body>
<div class="container">
<div class="left">Text</div>
<div class="right">Text</div>
</div>
</body>
</html>
,我将如何让每个 div 标签占据页面/视口的整个高度(这样即使 div 中的内容很少,绿色和红色也会一直延伸到页面) )?
【问题讨论】:
-
哦,互联网上到处都是解决方案。有一个巨大的线程(向下滚动以查看最新线程)stackoverflow.com/questions/1575141/…