I am trying to centre the logo on the navbar but it always sticks more to the left. Are there any ways to fix this issue with bootstrap classes?
The navbar includes a dropdown toggle button on the left, the logo in the centre, and two buttons (sign in and create account) on the right. I have tried various attempts with margin-left, mx-auto, and absolute positioning but none worked and I need a solution that will work when the screen is collapsed as well.
HTML
<div class="pos-f-t">
<div id="outter" style="width:100%">
<nav id="mainnavbar" class="navbar sticky-top navbar-dark bg-dark">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggleExternalContent" aria-controls="navbarToggleExternalContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<h3 id="logo">Logo</h3>
<form class="form-inline my-2 my-lg-0">
<b-link to="/login"><b-button id="login" class="navbarbutton" variant="outline-success">Log In</b-button></b-link>
<b-link to="/create"><b-button class="navbarbutton" variant="outline-success">Create Account</b-button></b-link>
</form>
</nav>
</div>
<!--...#navbarToggleExternalContent-->
</div><!--end pos-f-t-->
CSS
#logo{
/* margin-left: 10%;*/
margin-bottom: 0;
padding-bottom: 3px;
color: white;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
#login{
margin-right: 10px;
}
I expected every element to be equally spaced out on a wide display and when collapsed as well. Instead, the elements rearrange themselves when the display is narrow and the logo remains slightly to the left. I am also trying to avoid the absolute positioning solution as there will be overlapping on a narrow display.