css3 - Bootstrap navbar alighn menu items on main -


i looking way can align menu items in middle of navbar.

i increased width of navbar move links middle of navbar.

any or examples apreciated.

here current navbar layout.

  <nav class="navbar navbar-inverse navbar-fixed-top bs-docs-nav" role="banner">     <div class="container">       <div class="navbar-header">         <a class="navbar-brand" rel="home" href="index.php" title="logo">           <img src="images/logo.png">         </a>         <button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".bs-navbar-collapse">           <span class="sr-only">toggle navigation</span>           <span class="icon-bar"></span>           <span class="icon-bar"></span>           <span class="icon-bar"></span>         </button>       </div>       <nav class="collapse navbar-collapse bs-navbar-collapse" role="navigation">         <ul class="nav navbar-nav">           <li>             <a href="#" class="scroll-link" data-id="why">item1</a>           </li>           <li>             <a href="#" class="scroll-link" data-id="products">item2</a>           </li>           <li>             <a href="#">item3</a>           </li>                      </ul>         <ul class="nav navbar-nav navbar-right">           <li><a href="#">item4</a></li>         </ul>             </nav>     </div>   </nav> 

and here css

.navbar { min-width: 100%; font-size: 20px; background-color: #3a424c; border-bottom-width: 0px;}  .navbar-nav>li>a {      padding-top: 70px;      padding-bottom: 10px;      line-height: 25px;  }  .nav.navbar-nav>li>a{     color: white; }  .nav.navbar-nav>li>a:hover, .nav.navbar-nav>li>a:focus {     color: white;     background-color: rgba(110, 206, 230, 1); }  .navbar-brand { padding: 1px 10px; }   .navbar-wrapper {   position: absolute;   top: 0;   right: 0;   left: 0;   z-index: 20; }  /* flip around padding proper display in narrow viewports */ .navbar-wrapper > .container {   padding-right: 0;   padding-left: 0; } .navbar-wrapper .navbar {   padding-right: 15px;   padding-left: 15px; } .navbar-wrapper .navbar .container {   width: auto; }  .navbar img{      width: 185px;  } 

you can see edited sample here

https://jsfiddle.net/v49w742k/

i hoping if there's jsfiddle link can assist in sure way.

anyway, try css code .navbar-nav class:

.navbar-nav{ margin: 0 auto; display: table; float: none; } 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -