【发布时间】:2021-01-07 18:40:54
【问题描述】:
我正在开发 Angular 应用程序。我的下拉列表太长了,我无法滚动并且页面也结束了。这里使用Bootstrap 4.5.0。如何在其中添加垂直滚动条
这是我的代码
<div ngbDropdown class="d-inline-block">
<button class="btn btn-secondary btn-sm dropdown-toggle" id="dropdownMap" ngbDropdownToggle>
{{ selectedCountry}}
</button>
<div ngbDropdownMenu aria-labelledby="dropdownMap">
<ng-container *ngFor="let country of mapData">
<button ngbDropdownItem class="dropdown-item" (click)="mapCountry_selected(country)" >
{{country.post}}
</button>
</ng-container>
</div>
</div>
我试过了,但没用
.ngbDropdownMenu
{
max-height: 200px;
overflow-y: scroll;
}
.ngbDropdownItem
{
max-height: 200px;
overflow-y: scroll;
}
.ngbDropdown
{
max-height: 200px;
overflow-y: scroll;
}
【问题讨论】:
-
请标记所有相关技术。看起来你在这里使用 AngularJS 或其他东西。同时标记您的 Bootstrap 版本。
-
你可以使用
overflow-y:auto或overflow-y:scroll
标签: html css angular twitter-bootstrap ng-bootstrap