css - 通过外包装 div 垂直滚动左右 div,将右 div 滚动到水平滚动 - 始终可见
问题描述
我只需要一个纯 CSS 解决方案,不需要 Jquery 或 Java 脚本。您的帮助将不胜感激。
Wrapper div 将具有带有垂直滚动的 View 高度(它将滚动左右 div 以垂直滚动)。
Left 和 Right 的高度将始终相同地增长。而右 div 只需要水平滚动。溢出-x:滚动,这应该总是可见的右侧div水平滚动。
HTML 代码:
<div class="main_wrap" style="padding-top:10px;">
<div class="left">
<!-- loop -->
<div class="each_cell">
<p>1</p>
</div>
<div class="each_cell">
<p>2</p>
</div>
<div class="each_cell">
<p>3</p>
</div>
<div class="each_cell">
<p>4</p>
</div>
<div class="each_cell">
<p>5</p>
</div>
<div class="each_cell">
<p>6</p>
</div>
<div class="each_cell">
<p>7</p>
</div>
<div class="each_cell">
<p>8</p>
</div>
<div class="each_cell">
<p>9</p>
</div>
<div class="each_cell">
<p>10</p>
</div>
<!-- loop -->
</div>
<div class="chatRooms">
<div class="each_cell">
<div class="render_box">
Box
</div>
</div>
<div class="each_cell">
<p>2</p>
</div>
<div class="each_cell">
<p>3</p>
</div>
<div class="each_cell">
<p>4</p>
</div>
<div class="each_cell">
<p>5</p>
</div>
<div class="each_cell">
<p>6</p>
</div>
<div class="each_cell">
<p>7</p>
</div>
<div class="each_cell">
<p>8</p>
</div>
<div class="each_cell">
<p>9</p>
</div>
<div class="each_cell">
<p>10</p>
</div>
</div>
</div>
CSS 代码:
p{
font-family:"Trebuchet MS", Arial, Helvetica, sans-serif !important;
color:#fff !important;
font-size:14px !important;
line-height:19px !important;
margin-bottom:9px !important;
text-decoration:none !important;
}
.each_cell{
background:black;
width:100%;
height:39px;
float:left;
margin-bottom:3px;
}
.main_wrap {
width:80%;
background-color: #fff;
border: solid 1px #a0b5ba;
min-height: 100%;
height: 80vh;
overflow: auto;
overflow-x: hidden;
overflow-y: scroll;
float:left;
position: relative;
}
.left {
background:red;
width: 89px;
text-align: center;
position: absolute;
z-index: 100;
}
.chatRooms{
left:90px;
width:100%;
float:left;
position: relative;
overflow-x: scroll;
white-space: nowrap;
}
.render_box{
background:red;
width:100px;
height:20px;
left:1500px;
position:relative;
}
解决方案
推荐阅读
- python-3.x - 无法让 .exe 在其他机器上执行 - “No module named serial”错误
- android - 错误:flutter/lib/ui/ui_dart_state.cc(148) 未处理的异常
- reactjs - 使用 ReactStrap 的模态组件
- tensorflow - Tensorflow 估计器无法收敛从 Keras 转换的模型(使用 binary_crossentropy 时)
- django - 如果我使用 JWT Django rest_framework,我还需要使用 cookie 和会话吗
- ios - 无法分配 UIPickerView 委托或数据源
- sql-server - 重新安装 SYBASE oledb 提供程序后,它不会出现在 SSIS 连接管理器中
- r - R - 在循环中调用带有可变参数的函数
- c# - 在运行时向红隼添加/删除应用程序部分
- meshlab - 导出后失去质感?