I have implemented Material Design Bootstrap on my responsive website.
When viewing the website on a large screen, the navbar at the top displays:
- A link to my brand aligned to the left
- Two page links
- A profile dropdown aligned to the right
Large screen layout:
https://i.sstatic.net/zqfIY.png
The goal is for the layout to adjust when viewed on a smaller device. In this case, the layout should include:
- A toggler to expand the menu aligned to the left
- My Brand link aligned in the middle
- Profile dropdown still aligned to the right
Upon clicking the toggler, the menu with the two page links should expand without affecting the placement of the top navbar elements (toggler, My Brand, Profile).
Desired look on small screen after expansion:
https://i.sstatic.net/2zJXo.png
However, currently when the toggler is clicked, the My Brand link shifts to the right in the navbar and the Profile dropdown is displayed at the end of the expanded menu.
Current behavior (incorrect):
https://i.sstatic.net/UsDD0.png
You can view the live code in the mdbootstrap.com snippet editor here:
<nav class="navbar navbar-expand-sm navbar-dark indigo">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-top">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand font-weight-bolder" href="#">My Brand</a>
<div class="collapse navbar-collapse" id="navbar-top">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Contact</a>
</li>
</ul>
</div>
<div>
<ul class="navbar-nav mr-1 mt-lg-1">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle waves-effect waves-light" id="profile-dropdown"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-user"></i>
<span>Profile</span>
</a>
<div class="dropdown-menu dropdown-menu-right dropdown-info" aria-labelledby="profile-dropdown">
<a class="dropdown-item waves-effect waves-light text-nowrap" href="/account">
<i class="fas fa-user-cog navbar-profile-icon"></i>
<span>My account</span>
</a>
<a class="dropdown-item waves-effect waves-light text-nowrap" href="/logout">
<i class="fas fa-sign-out-alt navbar-profile-icon"></i>
<span>Logout</span>
</a>
</div>
</li>
</ul>
</div>
</nav>
Your assistance would be highly appreciated. Thank you!