gpt4 book ai didi

css - Bootstrap 列表组滚动

转载 作者:技术小花猫 更新时间:2023-10-29 10:31:22 25 4
gpt4 key购买 nike

<div class="panel panel-primary" id="result_panel">
<div class="panel-heading"><h3 class="panel-title">Result List</h3>
</div>
<div class="panel-body">
<ul class="list-group">
<li class="list-group-item"><strong>Signature
Accommodations</strong>(1480m)
</li>
# many li here..
<li class="list-group-item"><strong>The Barrington At Park
Place</strong>(15210m)
</li>
<li class="list-group-item"><strong>Camden Huntingdon
Apartments</strong>(15820m)
</li>
<li class="list-group-item"><strong>Enclave at Water's Edge
Apartments</strong>(15830m)
</li>
</ul>
</div>
</div>

我的 html 看起来像这样。我希望列表中有很多元素。大多数时候它会超出我的窗口, enter image description here

我试着这样设置我的 CSS:

.list-group{
margin-bottom: 10px;
overflow:scroll;
-webkit-overflow-scrolling: touch;
}

但这没有帮助,有什么想法吗?

最佳答案

尝试添加 max-height:

.list-group{
max-height: 300px;
margin-bottom: 10px;
overflow:scroll;
-webkit-overflow-scrolling: touch;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="panel panel-primary" id="result_panel">
<div class="panel-heading"><h3 class="panel-title">Result List</h3>
</div>
<div class="panel-body">
<ul class="list-group">
<li class="list-group-item"><strong>Signature
Accommodations</strong>(1480m)
</li>
<li class="list-group-item"><strong>Signature
Accommodations</strong>(1480m)
</li>
<li class="list-group-item"><strong>Signature
Accommodations</strong>(1480m)
</li>
<li class="list-group-item"><strong>Signature
Accommodations</strong>(1480m)
</li>
<li class="list-group-item"><strong>Signature
Accommodations</strong>(1480m)
</li>
<li class="list-group-item"><strong>Signature
Accommodations</strong>(1480m)
</li>
<li class="list-group-item"><strong>Signature
Accommodations</strong>(1480m)
</li>
<li class="list-group-item"><strong>Signature
Accommodations</strong>(1480m)
</li>
<li class="list-group-item"><strong>Signature
Accommodations</strong>(1480m)
</li>
<li class="list-group-item"><strong>Signature
Accommodations</strong>(1480m)
</li>
<li class="list-group-item"><strong>Signature
Accommodations</strong>(1480m)
</li>
<li class="list-group-item"><strong>Signature
Accommodations</strong>(1480m)
</li>
<li class="list-group-item"><strong>Signature
Accommodations</strong>(1480m)
</li>
<li class="list-group-item"><strong>Signature
Accommodations</strong>(1480m)
</li>
</ul>
</div>
</div>

关于css - Bootstrap 列表组滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47256185/

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