所以我有一个带左侧徽标的bootstrap导航栏菜单。现在,当我将窗口调整到一定宽度时,BB徽标将放在导航栏项目上方而不是旁边。当我稍微调整窗口大小时,徽标仍然在导航栏项旁边,但是当我再调整一点时,徽标位于项目上方。我在网上放了2个截图。有谁知道如何在较小的屏幕尺寸上将导航栏旁边的徽标放在哪里?
图像1(正常屏幕尺寸+小一点): 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
这是我的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;
}
答案 0 :(得分:2)
看起来它正在发生,因为导航栏太小而无法容纳所有导航栏元素。除了我使用流体容器来容纳它而不是普通容器之外,我和你完全一样。
<div class="container-fluid">
<!-- Your same navbar header can go here -->
</div>
如果您不想这样做,那么重新构建导航栏,这样它就不会像拥挤那样有帮助。就像下拉菜单一样。
这看起来很正常,因为你到达了容器的边界,所以导航包裹到下一行。