MrSpokes
MrSpokes

Reputation: 37

Bootstrap logo on same line as navbar items

so I have a bootstrap navbar menu with a logo on the left. Now when i resize my window to a certain width, the BB logo is put above the navbar items instead of next to it. When I resize my window a little bit, the logo is still next to the navbar items, but when i resize it a little bit more, the logo is above the items. I've put 2 screenshots online. Does anyone know how I can put the logo next to the navbar items on a smaller screensize?

image 1 (normal screen size + little smaller): https://www.dropbox.com/s/80nbcfsmf480c6c/Schermafdruk%202015-04-21%2016.24.34.png?dl=0

image 2 (even smaller size where the problem occurs): https://www.dropbox.com/s/t1h9foygxqdl42r/Schermafdruk%202015-04-21%2016.25.06.png?dl=0

This is my HTML:

<header class="navbar navbar-inverse navbar-fixed-top bs-docs-nav" role="banner">
        <div class="container">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <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>
                <a href="./" class="navbar-brand"><img src="applicatie/img/menu_icon.gif" class="img-responsive" alt="BB" height="50" width="50"></a>
            </div>
            <!-- Collect the nav links, forms, and other content for toggling -->
            <nav class="collapse navbar-collapse bs-navbar-collapse" role="navigation">
                <ul class="nav navbar-nav">
                    <li id="home">
                      <a href="./index.php">Home</a>
                    </li>
                    <li id="bands">
                      <a href="./bands.php">Bands</a>
                    </li>
                    <li id="jeugdhuizen">
                      <a href="./jeugdhuizen.php">Jeugdhuizen</a>
                    </li>
                    <li>
                      <a href="./phpBB3/index.php" target="_blank">Forum</a>
                    </li>
                    <li id="over">
                      <a href="./over.php">Over Bandbook</a>
                    </li>
                    <li id="registreer">
                        <a href="./signup.php">Registreer</a>
                    </li>
                   <li>
                        <form class="navbar-form navbar-right" id="loginoutform" role="form" action="./verwerklogin.php" method="post">
                            <div class="form-group" id="usernamediv">
                                <label class="sr-only" for="username">Username: </label>
                                <input type="text" id="username" name="username" placeholder="Username" class="form-control">
                            </div>
                            <div class="form-group" id="passworddiv">
                                <label class="sr-only" for="password">Password: </label>
                                <input type="password" id="password" name="password" placeholder="Password" class="form-control">
                            </div>
                            <button type="submit" class="btn btn-success" id="signin">Sign in</button>
                        </form>
                   </li>
                </ul>
            </nav><!-- /.navbar-collapse -->
        </div><!-- /.container -->
    </header>

and this is my css:

.navbar-inverse { background-color: #000000}
.navbar-inverse .navbar-nav>.active>a:hover,.navbar-inverse .navbar-nav>li>a:hover, .navbar-inverse .navbar-nav>li>a:focus { background-color: #B84E1A}
.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a, .navbar-inverse .navbar-nav>.open>a:hover,.navbar-inverse .navbar-nav>.open>a, .navbar-inverse .navbar-nav>.open>a:hover, .navbar-inverse .navbar-nav>.open>a:focus { background-color: #912C13}
.navbar-inverse .navbar-brand { color: white; font: 42px playbill, onyx, fantasy; text-align: center; padding-top:0px;}
.navbar-inverse .navbar-brand:hover { color: #B84E1A}
.navbar-inverse .navbar-nav>li>a { color: #999999}
.navbar-inverse .navbar-nav>li>a:hover, .navbar-inverse .navbar-nav>li>a:focus { color: #FFFFFF}
.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.open>a, .navbar-inverse .navbar-nav>.open>a:hover, .navbar-inverse .navbar-nav>.open>a:focus { color: #FFFFFF}
.navbar-inverse .navbar-nav>.active>a:hover, .navbar-inverse .navbar-nav>.active>a:focus { color: #FFFFFF}

body
{
  padding-top: 50px;
  background-color:#000000;
}

Upvotes: 1

Views: 8543

Answers (1)

Dylan Aspden
Dylan Aspden

Reputation: 1692

That looks like it's happening because the navbar is too small to fit all of the navbar elements. I have the exact same thing as you except I use a fluid container to hold it as opposed to a normal container.

<div class="container-fluid">
    <!-- Your same navbar header can go here -->
</div>

If you don't want to do that then restructuring your navbar so that it isn't as crowded would help. Like a drop down menu or something.

That seems normal because you reached the boundaries of the container so the nav wrapped to the next line.

Upvotes: 2

Related Questions