I've been trying to use Bootstrap 4, but no matter what I do, I can't seem to get the .navbar-toggler
button to align to the right. It feels like I'm missing something simple, but I just can't figure out what's going wrong.
Check out my code below:
NOTE: You may need to resize the window to see the button.
.title-bar {
padding: 0px;
margin: 0px auto;
}
.company-name {
font-family: "Trajan Pro";
font-size: 36px;
margin: 0px auto -15px 5px;
}
.navbar-nav {
width: 100%;
}
#seal {
margin: -50px auto;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" />
<nav class="navbar navbar-expand-md bg-dark navbar-dark title-bar">
<div class="container-fluid title-bar">
<div class="navbar-header">
<div class="d-flex flex-row d-md-none">
<a class="navbar-brand d-flex" href="#" style="margin: 0px 10px">
<img style="margin: 0; height:65px;" src="https://cdn.pixabay.com/photo/2016/02/08/10/10/coat-of-arms-1186256_960_720.png" id="seal" alt="lion head" />
<div class="company-name">
<div class="text-center">Fake</div>
<div class="text-center" style="font-size: 85%; margin-top: -20px;">Co.</div>
</div>
</a>
<button class="navbar-toggler align-self-center ml-auto" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
<span class="navbar-toggler-icon"></span>
</button>
</div>
<div class="d-none d-md-block">
<a class="navbar-brand company-name" href="#">Fake Company</a>
</div>
</div>
</div>
</nav>
<nav class="navbar navbar-expand-md bg-secondary navbar-dark">
<div class="collapse navbar-collapse" id="collapsibleNavbar">
<ul class="nav navbar-nav d-flex">
<li class="nav-item flex-fill text-center active"><a class="nav-link" href="#">Home</a></li>
<li class="nav-item flex-fill text-center"><a class="nav-link" href="#">About Us</a></li>
<li class="nav-item flex-fill text-center"><a class="nav-link" href="#">Profile</a></li>
<li class="nav-item flex-fill text-center">
<img class="d-none d-md-inline" src="https://cdn.pixabay.com/photo/2016/02/08/10/10/coat-of-arms-1186256_960_720.png" id="seal" alt="coa" style="max-width:110px; width:50%" />
</li>
<li class="nav-item flex-fill text-center"><a class="nav-link" href="#">Products</a></li>
<li class="nav-item flex-fill text-center"><a class="nav-link" href="#">Pricing</a></li>
<li class="nav-item flex-fill text-center"><a class="nav-link" href="#">Contact Us</a></li>
</ul>
</div>
</nav>
<div class="d-sm-none">
extra small
</div>
<div class="d-none d-sm-block d-md-none">
small
</div>
<div class="d-none d-md-block d-lg-none">
medium
</div>
<div class="d-none d-lg-block d-xl-none">
large
</div>
<div class="d-none d-xl-block">
extra large
</div>
For a live demo, check it out on JSFiddle.