使用html / css滚动拆分屏幕容器

问题描述 投票:0回答:3

我想在html / css中创建一个网页,将屏幕的宽度分成2,通过启用滚动将高度保持在100%,将始终保持这种方式,哪个将具有溢出内容水平和垂直滚动。下图显示了我想要做的基本图表:enter image description here

html css html5
3个回答
2
投票

您可以使用flexwrap div并排设置它们和样式框如下:

.wrap{display:flex;}
.box{
height: 100vh;
    width: 50vw;
    background-color: blue;
    overflow: scroll;
}
<div class="wrap">
  <div class="box">

  </div>
  <div class="box">

  </div>
</div>

你可以使用inline-block

.box{
  display:inline-block;
  height: 100vh;
   width: 49%;
    background-color: blue;
    overflow: scroll;
}
<div class="box">
</div>
<div class="box">
</div>

1
投票

你可以做这样简单容易的事

.container-main{max-width:50%;  width:50%; float:left; height:100vh; overflow-x: scroll;overflow-y: scroll; background:#EFF0F1; overflow:scroll;}
<html>
<head></head>
<body>

<div class="container-main"><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Why do we use it?

It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
</p></div>
<div class="container-main"><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Why do we use it?

It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
</p></div>


</body>

</html>

它也会增加垂直和水平


0
投票

这应该大致是你需要的

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>test</title>
    <style>
.display {
height: 1000px;
width: 95%;
overflow: hidden;
overflow-y: scroll;
overflow-x: scroll;
padding: 20px;
background: white;
border: 1px solid #d9d9d9;
}
    </style>
</head>
<body>
<table style="width:100%;">
    <tr>
        <td>
            <div class="display" >

            </div>
        </td>
        <td>
            <div class="display" >

            </div>
        </td>
    <tr>
</table>
</body>
</html>
© www.soinside.com 2019 - 2024. All rights reserved.