很难描述问题。所以,看看这个jsFiddle:
http://jsfiddle.net/arodrig0/xfs257hp/2/
当标题变小时,导航栏会跳到图像徽标下方。 我想制作一个宽度不超过970px的容器,菜单或徽标会变小或/和切换图标前的徽标出现。
问题出在哪里?
<title></title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<link href="./css/bootstrap.css" media="screen" rel="Stylesheet" type="text/css" />
<link href="./css/style_new.css" media="screen" rel="Stylesheet" type="text/css" />
<body>
<header class='container' role='navigation'>
<div class='navbar navbar-header'>
<a class="navbar-brand" id="logo" href="/">
<img alt="Brand" src="/layout/images/logo_new.gif" height="74px" width="237px">
</a>
<button type='button' class='navbar-toggle collapsed' data-toggle='collapse' data-target='.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>
<div id="containerNav">
<ul id="test"class='nav navbar-nav navbar-left collapse navbar-collapse'>
<li class="dropdown">
<a href='#' data-target='#' class='dropdown-toggle' data-toggle='dropdown'data-hover="dropdown">sample<br><span>sample</span></a>
<ul class='dropdown-menu' role='menu'>
<li><a href="#">sample</a></li>
<li><a href="#">sample</a></li>
<li><a href="#">sample</a></li>
<li><a href="#">sample</a></li>
<li class="bottom"></li>
</ul>
</li>
<li><a href='#' data-target='#' class='dropdown-toggle' data-toggle='dropdown'data-hover="dropdown">sample<br><span>sample</span></a></li>
<li class="dropdown">
<a href="#1" data-target='#' class='dropdown-toggle' data-toggle='dropdown'data-hover="dropdown">samples<br><span>samples</span></a>
<ul class='dropdown-menu' role='menu'>
<li><a href="#">sample</a></li>
<li><a href="#">sample</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" data-target='#' class='dropdown-toggle' data-toggle='dropdown'data-hover="dropdown">sample<br><span>sample</span></a>
<ul class='dropdown-menu' role='menu'>
<li><a href="#">sample</a></li>
<li><a href="#">sample</a></li>
<li><a href="#">sample</a></li>
<li><a href="#">sample</a></li>
</ul>
</li>
<li>
<a href="#">sample<br><span>sample</span></a>
</li>
<li class="dropdown">
<a href="#" data-target='#' class='dropdown-toggle' data-toggle='dropdown'data-hover="dropdown">sample<br><span>sample</span></a>
<ul class='dropdown-menu' role='menu'>
<li><a href="#">sample</a></li>
<li><a href="#">sample</a></li>
<li><a href="#">sample</a></li>
<li><a href="#">sample</a></li>
</ul>
</li>
</ul>
</div>
</header>
<div id="carousel" class="row">
</div>
</div> <!-- End Main Container-->
</body>
答案 0 :(得分:1)
您的导航菜单宽度太长。因此,当屏幕变小时,它没有足够的空间与同一行上的徽标一起挤压。 尝试添加一个包含列类“col-sm-4 col-md-3”和“col-sm-8 col-md-9”的div来包装nav头和containerNav。 http://jsfiddle.net/gnauLypt/1/
<div class="col-sm-4 col-md-3">
<div class="navbar navbar-header">
...
</div>
</div>
<div class="col-sm-8 col-md-9">
<div id="containerNav">
...
</div>
</div>
答案 1 :(得分:0)
没有准确到达,但有一种方法可以...... col-md-2 col-sm-2 'navbar navbar-header'和< b> col-md-10 col-sm-10 在div id 'containerNav'上。这些原始链接是因为这些链接显示的数量很多。您也可以尝试宽度:100%;高度:自动; 在 #logo img 上,使其在响应式屏幕上的宽度变得灵活。