Hi, I used as a template navbar with centred brand. I have some issue, because i can't set the navitems in proper places I try to use margin left and right in procents (%), but it mess up.
red points is the places where i want to have navitems
Hi, I used as a template navbar with centred brand. I have some issue, because i can't set the navitems in proper places I try to use margin left and right in procents (%), but it mess up.
red points is the places where i want to have navitems
So without knowing your code and version of Bootstrap your project was based on. I started with a fresh Bootstrap 4 project.
So the HTML looks something like
<nav class="navbar navbar-light navbar-expand-md">
<div class="container-fluid">
< a class="navbar-brand" href="#">Brand< /a>
<button class="navbar-toggler" data-toggle="collapse" data-target="#navcol-1">
< span class="sr-only">Toggle navigation< /span>
< span class="navbar-toggler-icon">< /span>
</button>
<div class="collapse navbar-collapse justify-content-md-between" id="navcol-1">
<ul class="nav navbar-nav justify-content-md-around">
<li role="presentation" class="nav-item">
< a href="#" class="nav-link active">First Item< /a>
</li>
<li role="presentation" class="nav-item">
< a href="#" class="nav-link">Second Item< /a>
</li>
</ul>
<ul class="nav navbar-nav justify-content-md-around">
<li role="presentation" class="nav-item">
< a href="#" class="nav-link active">First Item< /a>
</li>
<li role="presentation" class="nav-item">
< a href="#" class="nav-link">Second Item< /a>
</li>
</ul>
</div>
</div>
</nav>
Then I added the following CSS
@media (min-width: 768px) {
.navbar-brand {
position:absolute;
margin:auto;
left:41%;
right:41%;
text-align:center;
}
}
@media (min-width: 768px) {
.nav.navbar-nav {
width:40%;
}
}
At least it might be something that you can work from if not use exactly.
Saj
I already solve that by changing my mind about the design of navbar. But still thank you for such a exhaustive answer
Your welcome :)
Saj
Thanks for the CSS Saj!
Your welcome @sampson, glad I could help :)
Saj