当内容宽度为自动时,隐藏滚动条(仍然能够滚动)不起作用
16lz
2021-01-22
The suggested solution to the problem of visible scrollbars does not work in the below scenario :
针对可见滚动条问题的建议解决方案在以下方案中不起作用:
JSFIDDLe
CSS:
#hider {
position:absolute;
top: 0;
left:0;
height: 400px;
width: 200px;
background-color: green;
overflow: hidden;
}
#scroller {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
padding-right: 20px;
padding-bottom: 20px;
overflow: auto;
}
#content {
float: left;
height: auto;
width: auto;
}
HTML:
<div id="hider">
<div id="scroller">
<div id="content">
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
</div>
</div>
</div>
The problem I'm having is that the width
of <div id="content"></div>
cannot be known beforehand in my case, that's why I need to set it to auto
.
我遇到的问题是,在我的情况下,无法事先知道
的宽度,这就是我需要将其设置为auto的原因。更多相关文章
- 两个并列的div,一个确定宽度一个自动调整
- 如何让我的固定宽度移动网站始终显示“完全放大”?
- HTML5用户身份认证源代码:注册、登录、会话保持的解决方案
- CSS3列 - 添加第二个元素后的额外宽度
- 如何使用“left:100%”CSS规则保留DIV宽度
- 使三个标签填充容器的宽度
- 用于在表中强制换行的PHP或HTML/CSS解决方案
- PHP选择具有特定宽度的图像并构建网格
- 如何实现分布式文件上传解决方案?