How to center an image using bootstrap on NavBar bootstrap?

0

I have a big doubt on the bootstrap, I created a Navbar using the default bootstrap classes .... the problem is that I can not centralize a logo in the center of the navbar, it works only from left to right. of a solution that is standard bootstrap, so the code is.

<nav class="navbar navbar-default">


<div class="navbar-header">
  <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
    <span class="sr-only">Toggle navigation</span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
  </button>

  <a class="navbar-brand" href="#">
    <img alt="Brand" src="img/logo-3.svg" width="50px">
  </a>

</div>
    
asked by anonymous 17.06.2016 / 06:37

1 answer

1

To center relative to the screen, use% w / w% as follows:

.navbar-header {
    float: left;
    padding: 3px; /*opcional*/
    text-align: center;
    width: 100%;
}

.navbar-brand {
    position: absolute;
    float: none;
}
    
17.06.2016 / 07:45