To implement a flexible navigation menu, utilize the built-in flex properties in CSS to arrange menu items as flex elements.
For the navigation bar with the class .navbar.nav, apply the following additional classes:
.flex-row
This ensures that the elements are displayed horizontally in a row rather than vertically in a column.
.flex-wrap
The flex-wrap class allows the navigation element to wrap its children if necessary.
Furthermore, each .nav-item should have col-6 to split them into two columns.
<ul class="navbar-nav mr-auto flex-wrap flex-row">
<li class="nav-item active col-6">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item col-6">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item col-6">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
Make sure to adjust the markup for different screen sizes and breakpoints.