引导徽标与导航栏项目位于同一行 [英] Bootstrap logo on same line as navbar items
问题描述
所以我有一个引导导航栏菜单,左边带有徽标.现在,当我将窗口调整为特定宽度时,BB徽标将放置在导航栏项目上方而不是其旁边.当我调整窗口的大小时,徽标仍在导航栏项目旁边,但是当我调整窗口的大小时,徽标在项目上方.我已经将2个屏幕截图放在了网上.有人知道我如何在较小屏幕尺寸的导航栏项目旁边放置徽标?
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?
图片1(正常屏幕尺寸+小一点): https://www.dropbox .com/s/80nbcfsmf480c6c/Schermafdruk%202015-04-21%2016.24.34.png?dl = 0
image 1 (normal screen size + little smaller): https://www.dropbox.com/s/80nbcfsmf480c6c/Schermafdruk%202015-04-21%2016.24.34.png?dl=0
图像2(出现问题的尺寸甚至更小): https://www.dropbox .com/s/t1h9foygxqdl42r/Schermafdruk%202015-04-21%2016.25.06.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
这是我的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>
这是我的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;
}
推荐答案
这似乎是发生的,因为导航栏太小而无法容纳所有导航栏元素.除了使用液体容器盛放它而不是使用普通容器外,我和您有完全相同的东西.
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.
这篇关于引导徽标与导航栏项目位于同一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!