gpt4 book ai didi

css - 水平滚动条并禁用垂直滚动

转载 作者:行者123 更新时间:2023-11-28 17:28:35 25 4
gpt4 key购买 nike

如何添加水平滚动条?

(首先禁用自定义滚动条)

http://jsfiddle.net/s5ng001z/13/

html

<div style="height:70px; width:200px">
<div class="scrollbar_content scrollbar-inner">
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
</div>
</div>

CSS

.scrollbar_content {
height:100%;
width:100%;
min-width:100%;
overflow-x:scroll;
overflow-y:hidden;
}

.box {
display:inline-block;
margin:2px;
background:red;
height:50px;
width:50px;
}

最佳答案

您需要将此样式 white-space: nowrap; 添加到 .scrollbar_content http://jsfiddle.net/s5ng001z/14/

.scrollbar_content {
height:100%;
width:100%;
min-width:100%;
overflow-x:scroll;
overflow-y:hidden;
white-space: nowrap; // add this
}

.box {
display:inline-block;
margin:2px;
background:red;
height:50px;
width:50px;
}

关于css - 水平滚动条并禁用垂直滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38168682/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com