gpt4 book ai didi

html - Bootstrap 4 使下拉菜单可滚动

转载 作者:太空狗 更新时间:2023-10-29 15:24:39 25 4
gpt4 key购买 nike

我的下拉菜单在较小的设备上有问题。当我尝试此处的解决方案(即 overflow:auto/overflow-y:scroll)时,我无法让它滚动,即使我使用 也无法正常工作em>!重要。我能够滚动的是我的主页,即使下拉菜单是打开的。 enter image description here

<nav class="navbar navbar-toggleable-sm ">
<button class="navbar-toggler navbar-toggler-right main-navbar-toggler" type="button" data-toggle="collapse" data-target="#main-nav-collapse" aria-controls="navbarTogglerDemo02" aria-expanded="false" aria-label="Toggle navigation">
<span class="fa fa-bars"></span>
</button>
<a class="navbar-brand animation" data-animation ="fadeInLeft" href="#"><img src="/093017/img/logo-tmi.png" alt="logo"/></a>
<div class="collapse navbar-collapse" id = "main-nav-collapse" >
<ul class="nav navbar-nav navbar-main mr-auto mt-2 mt-md-0 animation" data-animation = "fadeInRight">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Vehicles</a>
<div class="dropdown-menu default-menu main-menu sm-main-menu animation" data-animation = "fadeIn">
<!-- Nav tabs -->
<div class="sm-main-nav" >
<a class="dropdown-item" href="#">Cars</a><hr>
<a class="dropdown-item" href="#">Vans & Pickup</a><hr>
<a class="dropdown-item" href="#">SUVs & Crossover</a><hr>
<a class="dropdown-item" href="#">MPVs</a><hr>
<a class="dropdown-item" href="#">Hybrid</a><hr>
<a class="dropdown-item" href="#">Performance</a>
</div>
</div>
</li>
<li class="nav-item">
<a class="nav-link " href="#">Owners</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Shop</a>
</li>
<li class="nav-item">
<a class="nav-link " href="#">Promotions</a>
</li>
</ul>
</div>

最佳答案

只是你可以在你的css中使用@media

@media (max-width: 500px) {
.dropdown-menu{
height:200px;
overflow-y:auto;
}
}

关于html - Bootstrap 4 使下拉菜单可滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47645634/

25 4 0