No matter what I try, I can\'t center something in Bootstrap navbar, any solutions for it?
I\'ve tried adding a div, using margin:0 auto;
or marg
from the docs
Navbars may contain bits of text with the help of .navbar-text. This class adjusts vertical alignment and horizontal spacing for strings of text.
i applied the .navbar-text class to my <li>
element, so the result is
<li class="nav-item navbar-text">
this centers the links vertically with respect to my navbar-brand img
I had a similar problem; the anchor text in my Bootstrap4 navbar wasn't centered. Simply added text-center
in the anchor's class.
make new style
.container {
position: relative;
}
.center-nav {
position: absolute;
left: 0;
right: 0;
margin: 0 auto;
width: auto;
max-width: 200px;
text-align: center;
}
.center-nav li{
text-align: center;
width:100%;
}
Replace website name UL with below
<ul class="nav navbar-nav center-nav">
<li class="nav-item"><a class="nav-link" href="#">Website Name</a></li>
</ul>
Hope this helps..