Introduction
In this article, I am going to explain how to use the Bootstrap 4 navbar and carousel slider in your project. The navbar is one of the prominent features of Bootstrap sites. Navbars are responsive meta components that serve as navigation sites for your application site. Navbar collapses in mobile views and becomes horizontal as width increases. On the other hand, a carousel is a slideshow of a series of content. It also includes support for previous/next controls and indicators.
To use Bootstrap 4 in your project, you need to have the following downloaded or cdn scripts. It should be added in a <head> tag.
- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
- <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" ></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" ></script>
- <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" ></script>
Default Navbar
To create default navbar add the following classes,
- Add the classes .navbar, .navbar-default to the <nav> tag.
- Add header class .navbar-header or .containert fluid to the <div> element. Include an <a> element with class .navbar-brand. You can add logo of the brand or any text with larger size.
- Add classes like .navbar-collapse to hide or display any content.
- Add classes like .navbar-nav, .nav-link, and .nav-item for unordered list with links.
Add the following code to create the responsive navigation bar in your project.
- <nav class="navbar navbar-expand-md navbar-dark bg-dark sticky-top">
- <div class="container-fluid">
- <a class="navbar-brand" href="#"> <i class="fa fa-Heart " style="color:white;font-size: 30px;">Webco</i></a>
- <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#mynav">
- <span class="navbar-toggler-icon"></span></button>
- <div class="collapse navbar-collapse" id="mynav">
- <ul class="navbar-nav ml-auto">
- <li class="nav-item active" >
- <a class="nav-link" href="#">Home</a>
- </li>
- <li class="nav-item " >
- <a class="nav-link" href="#">About Us</a>
- </li>
- <li class="nav-item" >
- <a class="nav-link" href="#">Service</a>
- </li>
- <li class="nav-item" >
- <a class="nav-link" href="#">Plans</a>
- </li>
- <li class="nav-item" >
- <a class="nav-link" href="#">Connect us</a>
- </li>
- </ul>
- </div></div></nav>

Join the conversation! Your thoughts help the community grow.