我正在尝试使用bootstrap 4网格系统创建一个大型下拉菜单,无论我对col进行什么操作,它都不会并排浮动。请给我一点灯!谢谢
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#">Test</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse container-fluid" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li id="menu-item-24" class="dropdown">
<a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">Borrow</a>
<ul class="dropdown-menu row">
<li class="col-sm-3 ">
<ul>
<li id="menu-item-29" class="dropdown-item"><a href="#" class="nav-link">0</a></li>
</ul>
</li>
<li class=" col-sm-3 ">
<ul>
<li id="menu-item-49" class="dropdown-item"><a href="#" class="nav-link">1</a></li>
</ul>
</li>
<li class=" col-sm-3 ">
<ul>
<li id="menu-item-52" class="dropdown-item"><a href="#" class="nav-link">2</a></li>
</ul>
</li>
<li class=" col-sm-3 ">
<ul>
<li id="menu-item-55" class="dropdown-item"><a href="#" class="nav-link">3</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</nav>
答案 0 :(得分:1)
使用此CSS并定义固定宽度
.dropdown-menu.show {
display: flex;
}
固定宽度下拉菜单
.navbar-expand-lg .navbar-nav .dropdown-menu {
min-width: 900px !important;
left: 0;
}