我正在开发一个bootstrap项目,我必须创建一个导航菜单like this:
我使用绝对位置但是当我将其缩放到较小的分辨率时它没有响应(当我缩小时它变得太小)。是否有任何方法可以制作响应式导航菜单(如上图所示)?
这是我的来源:
<div id ="top" class="container">
<div class="top-menu row">
<ul class="top-menu-buttons col-lg-12 col-xs-12">
<li class="col-lg-3 col-xs-3">
<a href="#" class="top-menu-button menu-bt-active">
<img class="img-responsive" src="img/home-bt-enable.png">
</a>
</li>
<li class="col-lg-3 col-xs-3">
<a href="#" class="top-menu-button menu-bt-inactive">
<img class="img-responsive" src="img/deal-bt.png">
</a>
</li>
<li class="col-lg-3 col-xs-3">
<a href="#" class="top-menu-button menu-bt-inactive">
<img class="img-responsive" src="img/about-bt.png">
</a>
</li>
<li class="col-lg-3 col-xs-3">
<a href="#" class="top-menu-button menu-bt-inactive">
<img class="img-responsive" src="img/contact-bt.png">
</a>
</li>
</ul>
</div>
</div>
CSS:
.top-menu ul,
.top-menu li{
display: inline-block;
}
.top-menu{
padding-left: 170px;
padding-right: 170px;
padding-bottom: 0;
bottom: 0;
top:auto;
}
.top-menu-button{
display: inline-block;
position: absolute;
width: 100%;
}
.menu-bt-active{
top: 22px;
}
.menu-bt-inactive{
top: 37px;
}
答案 0 :(得分:0)
<div class="nav navbar-default navbar-static-top">
<div class="container-fluid">
<button class="navbar-toggle" data-toggle="collapse" data-target=".navHeadCollapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="navbar-brand collapse navbar-collapse navHeadCollapse">
<a href="#">
<img id="img_navbar" src="img/home-bt-enable.png">
</a>
<a href="#">
<img id="img_navbar" src="img/deal-bt.png">
</a>
<a href="#">
<img id="img_navbar" src="img/about-bt.png">
</a>
<a href="#">
<img id="img_navbar" src="img/contact-bt.png">
</a>
<div id="search"class="input-group">
<input type="text" class="form-control" placeholder="Search">
<span class="input-group-btn">
<button class="btn btn-default" type="button">
<span class="glyphicon glyphicon-search"></span>
</button>
</span>
</div>
</div>
</div>
</div>
答案 1 :(得分:0)
试试这个CSS
#img_navbar
{
margin-left: 3%;
float: left;
margin-bottom: 10;
width:3%;
height:3%;
}
#search
{
width:20%;float:right;
}