5
I’m trying to leave options a centralized menu created in bootstrap 3, I’ve tried some alternatives, but none solved my problem, I have this snippet of code:
<div class="navbar navbar-default navbar-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <i class="icon-menu-1"></i> </button>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-left">
<li><a href="index.php">INÍCIO</a></li>
<li><a href="empresa.php">QUEM SOMOS</a></li>
<li><a href="produtos.php">PRODUTOS E SERVIÇOS</a></li>
<li><a href="livraria.php">LIVRARIA TÉCNICA</a></li>
<li><a href="noticias.php">NOTÍCIAS</a></li>
<li><a href="representantes.php">REPRESENTATES</a></li>
<li><a href="contato.php">CONTATO</a></li>
</ul>
</div>
</div>
My CSS is like this:
.navbar-collapse { max-height: 340px; padding-right: 15px; padding-left: 15px; overflow-x: visible; border-top: 1px solid transparent; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1); -webkit-overflow-scrolling: touch; } .nav { padding-left: 0; margin-bottom: 0; list-style: none; } .navbar-nav { margin: 7.5px -15px; } .navbar-nav > li > a { padding-top: 10px; padding-bottom: 10px; line-height: 20px; }
Some alternatives I tried:
.navbar-nav { width: 100%; text-align: center; > li { float: none; display: inline-block; }
And this:
.navbar .navbar-nav { display: inline-block; float: none; } .navbar .navbar-collapse { text-align: center; }
What I have today can be seen in this picture:
You created a separate file from your bootstrap.min to center the menu?
– Renato Lazaro
Hello @Renatolazaro, no man, I used native code.
– adventistapr