Unabe to expand data-toggle dropdown to full width of screen - html

I'm trying to extend my navbar data-toggle dropdown to the full width of the screen. For some reason, it still leaves white space on the left side when I set the viewport width to 100. I'm using bootstrap and setting a media query in my CSS which I'll show below.
<nav class="navbar navbar-expand-sm navbar-dark fixed-top bg-primary">
<div class="container">
<a class="navbar-brand text-white">Vince Clicks</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarToggler"
aria-controls="navbarToggler" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse bg-primary" id="navbarToggler">
<ul class="navbar-nav text-center mx-auto mb-2 mb-sm-0">
<li class="nav-item">
<a class="nav-link active" href="#home">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#about">About</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#skills">Skills</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#contact">Contact</a>
</li>
</ul>
<div class="d-none d-sm-flex">
<a class="btn btn-social-icon btn-linkedin" href="#"><i
class="fab fa-2x fa-github-square"></i></a>
<a class="btn btn-social-icon btn-linkedin" href="http://www.linkedin.com/in/"><i
class="fab fa-2x fa-linkedin"></i></a>
</div>
</div>
</div>
</nav>
#media (max-width: 576px){
.navbar-nav{
margin-top: 11px;
max-height: 158px;
width: 100vw
}
.nav-link{
border-top: 1px solid black;
}
}

The .container has left and right padding (x-axis), remove it by adding .px-0 and your example works. There is no need to set the width in your media query.
In the following snippet, in order to compensate for the lost padding
I have added margins to .navbar-brand and .navbar-toggler
with .ms-3 and .me-3, respectively:
#media (max-width: 576px) {
.navbar-nav {
margin-top: 11px;
max-height: 158px;
}
.nav-link {
border-top: 1px solid black;
}
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous">
<nav class="navbar navbar-expand-sm navbar-dark fixed-top bg-primary">
<div class="container px-0">
<a class="navbar-brand text-white ms-3">Vince Clicks</a>
<button class="navbar-toggler me-3" type="button" data-bs-toggle="collapse" data-bs-target="#navbarToggler" aria-controls="navbarToggler" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse bg-primary" id="navbarToggler">
<ul class="navbar-nav text-center mx-auto mb-2 mb-sm-0">
<li class="nav-item">
<a class="nav-link active" href="#home">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#about">About</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#skills">Skills</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#contact">Contact</a>
</li>
</ul>
<div class="d-none d-sm-flex">
<a class="btn btn-social-icon btn-linkedin" href="#"><i class="fab fa-2x fa-github-square"></i></a>
<a class="btn btn-social-icon btn-linkedin" href="http://www.linkedin.com/in/"><i class="fab fa-2x fa-linkedin"></i></a>
</div>
</div>
</div>
</nav>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.1.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-/bQdsTh/da6pkI1MST/rWKFNjaCP5gBSY4sEBT38Q/9RBh9AH40zEOg7Hlq2THRZ" crossorigin="anonymous"></script>

Related

How do I inline a div in navbar element

I am having some problems with my html. I am making a navbar offcanvas. Here is my code:
<nav class="navbar navbar-dark bg-dark">
<div class="container-fluid">
<a class="navbar-brand mx-2" href="#">Olau Pla Richart</a>
<button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasDarkNavbar" aria-controls="offcanvasDarkNavbar">
<span class="navbar-toggler-icon"></span>
</button>
<div class="offcanvas offcanvas-end text-bg-dark" tabindex="-1" id="offcanvasDarkNavbar" aria-labelledby="offcanvasDarkNavbarLabel">
<div class="offcanvas-header">
<h4 class="offcanvas-title" id="offcanvasDarkNavbarLabel">Menu</h4>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<ul class="navbar-nav justify-content-end flex-grow-1 pe-3">
<li class="nav-item">
<h5><a class="nav-link active border-bottom bi bi-house" href="#home"> Home</a></h5>
</li>
<li class="nav-item">
<h5><a class="nav-link border-bottom bi bi-info-circle" href="#about"> About</a></h5>
</li>
<li class="nav-item">
<h5><a class="nav-link border-bottom bi bi-person-lines-fill" href="#contact"> Contact</a></h5>
</li>
<li class="nav-item">
<h5><a class="nav-link border-bottom bi bi-card-heading" href="#"> Blog</a></h5>
</li>
</ul>
</div>
</div>
</div>
<div>
<a>Test</a>
</div>
</nav>
What I am trying to do is get the Test in the same line as Olau Pla Richart. Here is what my code does at the moment:
I tried adding display: inline; and display: inline-block; but I got no change.
You need to move your div, also wrap a and that same div (now span) in a div to not get spaced because bootstrap 5 has this rule .navbar > .container-fluid { ... , justify-content: space-between}
.test {
color: white
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.2.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
<nav class="navbar navbar-dark bg-dark">
<div class="container-fluid">
<div>
<a class="navbar-brand mx-2" href="#">Olau Pla Richart</a>
<span>
<a class="test" href="#">Test</a>
</span>
</div>
<button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasDarkNavbar" aria-controls="offcanvasDarkNavbar">
<span class="navbar-toggler-icon"></span>
</button>
<div class="offcanvas offcanvas-end text-bg-dark" tabindex="-1" id="offcanvasDarkNavbar" aria-labelledby="offcanvasDarkNavbarLabel">
<div class="offcanvas-header">
<h4 class="offcanvas-title" id="offcanvasDarkNavbarLabel">Menu</h4>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<ul class="navbar-nav justify-content-end flex-grow-1 pe-3">
<li class="nav-item">
<h5><a class="nav-link active border-bottom bi bi-house" href="#home"> Home</a></h5>
</li>
<li class="nav-item">
<h5><a class="nav-link border-bottom bi bi-info-circle" href="#about"> About</a></h5>
</li>
<li class="nav-item">
<h5><a class="nav-link border-bottom bi bi-person-lines-fill" href="#contact"> Contact</a></h5>
</li>
<li class="nav-item">
<h5><a class="nav-link border-bottom bi bi-card-heading" href="#"> Blog</a></h5>
</li>
</ul>
</div>
</div>
</div>
</nav>
Try border-bottom (border-bottom: 1px solid #ccc)
details
Try adding display: flex; to your navbar class.
You do not need any additional CSS, You just need to place the a in the the proper place (after .navbar-brand), and add .navbar-text to get the correct color for .navbar-dark/.navbar-light. It will be centered between .navbar-brand and .navbar-toggler by default. You can use .me-auto to left-align it, or .ms-auto to right-align.
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.2.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
<nav class="navbar navbar-dark bg-dark">
<div class="container-fluid">
<a class="navbar-brand mx-2" href="#">Olau Pla Richart</a>
<a class="navbar-text ms-auto me-2">Test</a>
<button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasDarkNavbar" aria-controls="offcanvasDarkNavbar">
<span class="navbar-toggler-icon"></span>
</button>
<div class="offcanvas offcanvas-end text-bg-dark" tabindex="-1" id="offcanvasDarkNavbar" aria-labelledby="offcanvasDarkNavbarLabel">
<div class="offcanvas-header">
<h4 class="offcanvas-title" id="offcanvasDarkNavbarLabel">Menu</h4>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<ul class="navbar-nav justify-content-end flex-grow-1 pe-3">
<li class="nav-item">
<h5><a class="nav-link active border-bottom bi bi-house" href="#home"> Home</a></h5>
</li>
<li class="nav-item">
<h5><a class="nav-link border-bottom bi bi-info-circle" href="#about"> About</a></h5>
</li>
<li class="nav-item">
<h5><a class="nav-link border-bottom bi bi-person-lines-fill" href="#contact"> Contact</a></h5>
</li>
<li class="nav-item">
<h5><a class="nav-link border-bottom bi bi-card-heading" href="#"> Blog</a></h5>
</li>
</ul>
</div>
</div>
</div>
</nav>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.2.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>

How to set Bootstrap Navbar active class

I am using Bootrstap 4 and I cannot figure out why my active class is not working. I have followed examples and documentation but I am still having issues figuring out why it is not working.
My head tag conains jquery then popper then bootstrap in index.html.
COMPONENT.HTML
<!--COMPONENT.HTML-->
<nav class="navbar navbar-expand-lg navbar-dark navbar-custom">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTop"
aria-controls="navbarTop" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarTop">
<ul class="nav navbar-nav w-100">
<li class="nav-item ml-4">
<a class="nav-link active" data-toggle="collapse" data-target=".navbar-collapse.show"
routerLink="">Home<span class="sr-only">(current)</span></a>
</li>
<li class="nav-item ml-4">
<a class="nav-link" data-toggle="collapse" data-target=".navbar-collapse.show"
routerLink="/landscaping">Landscaping</a>
</li>
<li class="nav-item ml-4">
<a class="nav-link" data-toggle="collapse" data-target=".navbar-collapse.show"
routerLink="/fences-decks">Fences & Decks</a>
</li>
<li class="nav-item ml-4">
<a class="nav-link" data-toggle="collapse" data-target=".navbar-collapse.show"
routerLink="/sprinkler">Sprinklers</a>
</li>
<li class="nav-item ml-4">
<a class="nav-link" data-toggle="collapse" data-target=".navbar-collapse.show"
routerLink="/remodeling">Remodeling</a>
</li>
<li class="nav-item ml-4">
<a class="nav-link" data-toggle="collapse" data-target=".navbar-collapse.show"
routerLink="/concrete">Concrete</a>
</li>
<!-- <li class="nav-item ml-4">
<a class="nav-link" routerLink="/reviews">Google Reviews</a>
</li> -->
<li class="nav-item ml-4">
<a class="nav-link" data-toggle="collapse" data-target=".navbar-collapse.show"
routerLink="/about">About</a>
</li>
<br>
<div class="text-right ml-auto">
<li class="nav-item">
<a class="nav-link text-info" data-toggle="modal" data-target="#emailForm"><span class="material-icons lightgrey">email</span> user#email.com</a>
</li>
<li class="nav-item">
<a class="nav-link text-info" href="tel:1-801-759-4477"><span class="material-icons lightgrey">phone_in_talk</span> 801-759-4477</a>
</li>
</div>
</ul>
<script>
$("#navbarTop .nav .nav-item").on("click", function(){
$(".nav-link").find(".active").removeClass("active");
$(this).addClass("active");
});
</script>
</div>
</nav>
$(document).ready(function() {
$(".nav-item a").click(function() {
let active = $(".active-nav-item")
if (active) {
$(active).removeClass("active-nav-item");
$(this).parent().addClass("active-nav-item");
}
})
})
#topbar {
.topbar-social-list {
display: flex;
list-style: none;
padding: 0;
margin: 0;
text-align: center;
.topbar-social-list-item {
cursor: pointer;
transition: all 0.3s;
i {
transition: all 0.3s;
}
& i:hover {
transition: all 0.3s;
color: white !important;
}
}
}
}
.nav-sec {
background-color: rgb(14, 13, 13) !important;
.dropdown {
&:hover {
.dropdown-menu {
display: block; // left: -10px; border-radius: 0% !important; } } } .nav-list{ .nav-list-item{ transition: all 0.3s; &:hover{ transition: all 0.3s; background-color:
red !important;
a {
color: blue !important;
}
}
}
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<section id="topbar" class="bg-dark">
<div class="container">
<div class="row">
<div class="col d-flex p-2">
<div class="topbar-mail me-3">
<i class="fa-solid fa-envelope text-danger"></i>
<span class="text-secondary">
info#example.com
</span>
</div>
<div class="topbar-phone">
<i class="fa-solid fa-mobile text-danger"></i>
<span class="text-secondary">
+1 5589 55488 55
</span>
</div>
</div>
<div class="col d-flex justify-content-end">
<ul class="topbar-social-list align-items-center">
<li class="topbar-social-list-item">
<i class="fa-brands fa-twitter text-secondary text-center me-3"></i>
</li>
<li class="topbar-social-list-item">
<i class="fa-brands fa-facebook text-secondary text-center me-3"></i>
</li>
<li class="topbar-social-list-item">
<i class="fa-brands fa-instagram text-secondary text-center me-3"></i>
</li>
<li class="topbar-social-list-item">
<i class="fa-brands fa-linkedin text-secondary text-center me-3"></i>
</li>
</ul>
</div>
</div>
</div>
</section>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark nav-sec p-0">
<div class="container">
<a class="navbar-brand fs-2 fw-bold" href="#">DAY</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavDropdown" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-end nav-list" id="navbarNavDropdown">
<ul class="navbar-nav">
<li class="nav-item nav-list-item p-lg-3 active-nav-item">
<a class="nav-link active" aria-current="page" href="#">Home</a>
</li>
<li class="nav-item nav-list-item p-lg-3">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item nav-list-item p-lg-3">
<a class="nav-link" href="#">Pricing</a>
</li>
<li class="nav-item nav-list-item dropdown p-lg-3">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Dropdown link
</a>
<ul class="dropdown-menu mt-3" aria-labelledby="navbarDropdownMenuLink">
<li><a class="dropdown-item" href="#">Action</a></li>
<li><a class="dropdown-item" href="#">Another action</a></li>
<li><a class="dropdown-item" href="#">Something else here</a></li>
</ul>
</li>
<li class="nav-item nav-list-item p-lg-3">
<a class="nav-link" href="#">Contact</a>
</li>
</ul>
</div>
</div>
</nav>

Show link title on mobile menu

I want to use icons instead of text in my navbar, but display title when I hover. The "title" text displays fine on both mobile and regular versions. But on mobile display, I want to show the title text next to the icons automatically without hovering. the code below shows the icons (title) when i hover over menu item. but i want the title displayed without hovering when the hamburger menu is open on mobile.
<nav class="navbar navbar-expand-lg navbar-dark"> <a class="navbar-brand" href="/index.shtml"><img src="images/cardinal.png" width="80" alt=""/></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent1" aria-controls="navbarSupportedContent1" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button>
<div class="collapse navbar-collapse" id="navbarSupportedContent1">
<ul class="navbar-nav ml-auto">
<li class="nav-item"> <i class="fas fa-home"></i> </li>
<li class="nav-item"> <a class="nav-link text-white" href="memberinfo.html" title="Members"><i class="fas fa-user-friends"></i></a> </li>
<li class="nav-item"> <a class="nav-link text-white" href="faq.shtml" title="FAQ"><i class="far fa-question-circle"></i></a> </li>
<li class="nav-item"> <a class="nav-link text-white" href="contacts.shtml" title="Contact Us"><i class="far fa-envelope"></i></a> </li>
</ul>
</div>
</nav>
Use a pseudo element to display the title attribute. Control when it should be displayed with a media query.
#media (max-width: 768px) {
.nav-link::after {
content: attr(title);
}
}
Example:
.navbar-dark {
background: hotpink;
}
.fas,
.far {
display: inline-block;
width: 20px;
height: 20px;
outline: 1px solid white;
}
#media (max-width: 768px) {
.nav-link::after {
content: attr(title);
}
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
<nav class="navbar navbar-expand-lg navbar-dark">
<a class="navbar-brand" href="/index.shtml"><img src="images/cardinal.png" width="80" alt="" /></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent1" aria-controls="navbarSupportedContent1" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button>
<div class="collapse navbar-collapse" id="navbarSupportedContent1">
<ul class="navbar-nav ml-auto">
<li class="nav-item"> <i class="fas fa-home"></i> </li>
<li class="nav-item"> <a class="nav-link text-white" href="memberinfo.html" title="Members"><i class="fas fa-user-friends"></i></a> </li>
<li class="nav-item"> <a class="nav-link text-white" href="faq.shtml" title="FAQ"><i class="far fa-question-circle"></i></a> </li>
<li class="nav-item"> <a class="nav-link text-white" href="contacts.shtml" title="Contact Us"><i class="far fa-envelope"></i></a> </li>
</ul>
</div>
</nav>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>

How to make navbar more prominent?

I have a navbar on my page but for some reason only the 'homepage' link is pure white. the rest of the links are not as bright. I am trying to create a transparent navbar with a picture as a background. i have managed to do that but the 'Home' link is considerably brighter and more prominent then the rest of the links. the image can be seen below:
<div class="container-fluid p-0">
<nav class="navbar navbar-expand-lg fixed-top navbar-dark">
<a class="navbar-brand" href="#">
<i class="fas fa-mountain fa-2x mx-3"></i>Greatness</a> <!--This is the icon for the brand-->
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false"
aria-label="Toggle navigation">
<i class="fas fa-align-right text-light"></i>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<div class="mr-auto"></div>
<ul class="navbar-nav justify-content-center">
<li class="nav-item active">
<a class="nav-link" href="indexHome.html">HOME</a>
</li>
<li class="nav-item">
<a class="nav-link" href="AboutUs.html">ABOUT US
<span class="sr-only">(current)</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">IDEAS</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">MOTIVATION</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">LOG IN</a>
</li>
</ul>
</div>
</nav>
</div>
CSS
.nav-item:last-child{
padding-right: 10.5em;
}
.nav-item{
padding: 0.9em;
color: white;
font-size: 17px;
}
.navbar-brand{
padding-left: 8em;
}
It is because an active class is defined in the li which is wrapped around it, like <li class="nav-item active">. Add the active class to its siblings and it should work.

Bootstrap 4 Navbar align content left, center and right [duplicate]

This question already has answers here:
Bootstrap NavBar with left, center or right aligned items
(14 answers)
Center an element in Bootstrap Navbar
(10 answers)
Closed 4 years ago.
I need to achieve the brand logo in left, menu items to be center and couple of buttons in the right. I have tried using the flexbox approach but the center items does not align well. and also the brand logo has a wide space with a clickable link.
JS Fiddle
<nav class="navbar navbar-light navbar-expand-md bg-faded justify-content-center">
<div class="container">
<img src="assets/logo/" alt="logo">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsingNavbar3">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse w-100 ml-auto" id="collapsingNavbar3">
<ul class="navbar-nav w-100 justify-content-center">
<li class="nav-item active">
<a class="nav-link" href="#">How it works</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Become a tutor</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricing</a>
</li>
</ul>
<ul class="nav navbar-nav ml-auto w-100 justify-content-end">
<li class="nav-item">
<a class="btn btn-link" href="#">Sign In</a>
</li>
<li class="nav-item">
<a class="btn btn-primary" href="#">Sign Up</a>
</li>
</ul>
</div>
</div>
</nav>
Answering my own question few months later.
<nav class="navbar navbar-light navbar-expand-md bg-white justify-content-center main--navigation dark-header">
<a href="#" class="navbar-brand d-flex w-50 mr-auto">
<img src="assets/images/logo-header.svg" class="navigation__logo" alt="Logo" />
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsingNavbar">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse w-100" id="collapsingNavbar">
<ul class="navbar-nav w-100 justify-content-center">
<li class="nav-item active">
<a class="nav-link" href="#">Browse</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">How it works</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Become a tutor</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Prices</a>
</li>
</ul>
<ul class="nav navbar-nav ml-auto w-100 justify-content-end">
<li class="nav-item dropdown no-arrow mx-1 nav-link px-0">
<button id="bookmarksDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" type="button" class="btn btn-outline-secondary btn-outlined" data-original-title="Bookmarks"><img src="assets/icons/bookmark-header-dark.svg"></button>
<div class="dropdown-list dropdown-menu dropdown-menu-right" aria-labelledby="alertsDropdown">
<h6 class="dropdown-header">
Bookmarks
</h6>
</div>
</li>
<li class="nav-item dropdown no-arrow mx-1 nav-link px-0">
<button id="messagesDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" type="button" class="btn btn-outline-secondary btn-outlined" data-original-title="Notifications"><img src="assets/icons/bell-header-dark.svg"></button>
<div class="dropdown-list dropdown-menu dropdown-menu-right" aria-labelledby="notificationsDropdown">
<h6 class="dropdown-header">
You do not have any notifications yet
</h6>
</div>
</li>
<li class="nav-item dropdown no-arrow mx-1 ml-3 mr-0 nav-link px-0">
<a class="nav-link dropdown-toggle pr-0" href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<div class="header__profile__title d-inline-block text-right align-middle">
<span class="mr-2 d-none d-block header__profile__name">Aaron Alexander</span>
<span class="mr-2 d-none d-block header__profile__role">Student</span>
</div>
<div class="header__profile d-inline-block">
<img class="img-profile rounded" src="assets/images/andrew-franklin.jpeg" alt="Aaron Alexander">
</div>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--grow-in" aria-labelledby="userDropdown">
<a class="dropdown-item" href="#">
<i class="fas fa-user fa-sm fa-fw mr-2"></i>
Profile
</a>
<a class="dropdown-item" href="#">
<i class="fas fa-cogs fa-sm fa-fw mr-2"></i>
Settings
</a>
<a class="dropdown-item" href="#">
<i class="fas fa-list fa-sm fa-fw mr-2"></i>
Activity Log
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#logoutModal">
<i class="fas fa-sign-out-alt fa-sm fa-fw mr-2 text-gray-400"></i>
Logout
</a>
</div>
</li>
</ul>
</div>
</nav>
That container div you added after the nav makes you loose the flexbox attributes.
You also set the logo with the class "w-100" which takes all possible width.
I removed those and got a nicely aligned navbar.
<nav class="navbar navbar-light navbar-expand-md bg-faded justify-content-center align-items-center">
<img src="assets/logo/" alt="logo">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsingNavbar3">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse w-100 ml-auto" id="collapsingNavbar3">
<ul class="navbar-nav w-100 justify-content-center">
<li class="nav-item active">
<a class="nav-link" href="#">How it works</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Become a tutor</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricing</a>
</li>
</ul>
<ul class="nav navbar-nav ml-auto w-100 justify-content-end">
<li class="nav-item">
<a class="btn btn-link" href="#">Sign In</a>
</li>
<li class="nav-item">
<a class="btn btn-primary" href="#">Sign Up</a>
</li>
</ul>
</div>
</nav>
Here's a fiddle with the results.
here is my working example.
You just need to put all content into single div in order to Justify content with bootstrap classes. Also, I am using navbar-brand and making them show hide depending on screen resolution. You can do that with js which might be smoother once the page loads completely.
#media only screen and (max-width: 991px) {
.logo {
display: flex;
}
.collapse .navbar-brand {
display: none
}
}
#media only screen and (min-width: 992px) {
.logo {
display: none;
}
.collapse .navbar-brand {
display: none;
}
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<nav class="navbar navbar-expand-lg navbar-light bg-light d-flex ">
<a class="navbar-brand logo" href="#">Navbar</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 justify-content-between" id="navbarSupportedContent">
<a class="navbar-brand" href="#">Navbar</a>
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Dropdown
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
<form class="form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
</form>
</div>
</nav>