Then, you can use the .container
and .row
classes to create a container for the navigation bar and a row for the navigation elements. Within the row, you can use the .col-*
classes to create columns for the navigation elements.
In addition to the grid classes, you can also use Bootstrap's navigation classes such as .navbar
, .navbar-brand
, .navbar-nav
, and .nav-item
to style the navigation bar and its elements.
Here is an example of a responsive navigation bar using Bootstrap's grid system:
<nav class="navbar navbar-expand-lg navbar-light bg-light"> <div class="container"> <a class="navbar-brand" href="#">Brand</a> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="navbarNav"> <ul class="navbar-nav"> <li class="nav-item"> <a class="nav-link" href="#">Home</a> </li> <li class="nav-item"> <a class="nav-link" href="#">About</a> </li> <li class="nav-item"> <a class="nav-link" href="#">Contact</a> </li> </ul> </div> </div> </nav>
You can also use the .navbar-toggler
class and data-toggle
and data-target
attributes to create a toggle button that shows and hides the navigation elements on smaller screens, which will make the navigation bar responsive.
Note: This is just an example, you can customize it as per your requirement.
Social Plugin