I'm having trouble centering the logo on the navbar as it always leans more towards the left. Is there a way to resolve this problem using Bootstrap classes?
The navbar consists of a dropdown toggle button on the left, the logo in the center, and two buttons (sign-in and create account) on the right. I've tried different methods like margin-left, mx-auto, and absolute positioning but none seem to work, especially when the screen is collapsed. Any suggestions for a solution that works regardless of screen size?
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;
}
My expectation was for all elements to be equally spaced out both on wide displays and when collapsed. However, the elements reposition themselves on narrow screens, leaving the logo slightly to the left. I'm hoping to find a solution that doesn't involve absolute positioning to avoid overlapping on smaller screens.